From 85cc5d7d185905f42675f76a1ab318d972ed8886 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:37:53 +0530 Subject: [PATCH 1/2] bump version to 1.0.27+27 --- lib/ui/home_page.dart | 67 +++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/lib/ui/home_page.dart b/lib/ui/home_page.dart index c14c1c6c95..b3b6db9fb7 100644 --- a/lib/ui/home_page.dart +++ b/lib/ui/home_page.dart @@ -17,7 +17,6 @@ import 'package:ente_auth/ui/code_widget.dart'; import 'package:ente_auth/ui/common/loading_widget.dart'; import 'package:ente_auth/ui/scanner_page.dart'; import 'package:ente_auth/ui/settings_page.dart'; -import 'package:ente_auth/utils/device_info.dart'; import 'package:flutter/material.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:move_to_background/move_to_background.dart'; @@ -64,7 +63,7 @@ class _HomePageState extends State { } void _applyFiltering() { - if (_searchText.isNotEmpty) { + if (_searchText.isNotEmpty && _showSearchBox) { final String val = _searchText.toLowerCase(); _filteredCodes = _codes .where( @@ -148,22 +147,36 @@ class _HomePageState extends State { ), resizeToAvoidBottomInset: false, appBar: AppBar( - title: const Text('ente Authenticator'), + title: !_showSearchBox + ? const Text('ente Authenticator') + : TextField( + autofocus: _searchText.isEmpty, + controller: _textController, + onChanged: (val) { + _searchText = val; + _applyFiltering(); + }, + decoration: const InputDecoration( + hintText: 'Search...', + border: InputBorder.none, + ), + ), actions: [ IconButton( - icon: const Icon(Icons.search), + icon: _showSearchBox + ? const Icon(Icons.clear) + : const Icon(Icons.search), tooltip: 'Search', onPressed: () { setState( () { _showSearchBox = !_showSearchBox; if (!_showSearchBox) { - _searchText = ""; - _applyFiltering(); - } else if (_textController.text.isNotEmpty) { + _textController.clear(); + } else { _searchText = _textController.text; - _applyFiltering(); } + _applyFiltering(); }, ); }, @@ -200,42 +213,16 @@ class _HomePageState extends State { } else if (_showSearchBox) { return Column( children: [ - Center( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 24.0), - child: TextField( - autofocus: _searchText.isEmpty, - controller: _textController, - onChanged: (val) { - _searchText = val; - _applyFiltering(); - }, - decoration: InputDecoration( - // prefixIcon: const Icon(Icons.search), - suffixIcon: IconButton( - icon: const Icon(Icons.clear), - onPressed: () { - _textController.clear(); - _searchText = ""; - _applyFiltering(); - }, - ), - hintText: 'Search...', - border: InputBorder.none, - ), - ), - ), - ), - _filteredCodes.isNotEmpty - ? Expanded( - child: ListView.builder( + Expanded( + child: _filteredCodes.isNotEmpty + ? ListView.builder( itemBuilder: ((context, index) { return CodeWidget(_filteredCodes[index]); }), itemCount: _filteredCodes.length, - ), - ) - : (const Text("No result")), + ) + : const Center(child: (Text("No result"))), + ), ], ); } else { From 120fee358bd591b585976ee52f1a5479dc94c8c8 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:38:18 +0530 Subject: [PATCH 2/2] bump version to 1.0.28+28 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index e2df51a0a7..56d396b3c6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ente_auth description: ente two-factor authenticator -version: 1.0.27+27 +version: 1.0.28+28 publish_to: none environment: