made search icon and search text field
This commit is contained in:
parent
f3667f3d40
commit
4fe2af4be1
|
@ -6,6 +6,7 @@ import 'package:photos/ente_theme_data.dart';
|
||||||
import 'package:photos/events/sync_status_update_event.dart';
|
import 'package:photos/events/sync_status_update_event.dart';
|
||||||
import 'package:photos/services/sync_service.dart';
|
import 'package:photos/services/sync_service.dart';
|
||||||
import 'package:photos/ui/header_error_widget.dart';
|
import 'package:photos/ui/header_error_widget.dart';
|
||||||
|
import 'package:photos/ui/viewer/search/searchWidget.dart';
|
||||||
|
|
||||||
const double kContainerHeight = 36;
|
const double kContainerHeight = 36;
|
||||||
|
|
||||||
|
@ -209,7 +210,9 @@ class StatusBarBrandingWidget extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
height: kContainerHeight,
|
height: kContainerHeight,
|
||||||
padding: const EdgeInsets.only(left: 12),
|
padding: const EdgeInsets.only(left: 12),
|
||||||
child: const Align(
|
child: const Align(
|
||||||
|
@ -224,6 +227,13 @@ class StatusBarBrandingWidget extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerRight, child: SearchIconWidget()),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
81
lib/ui/viewer/search/searchWidget.dart
Normal file
81
lib/ui/viewer/search/searchWidget.dart
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/src/foundation/key.dart';
|
||||||
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
|
import 'package:photos/ente_theme_data.dart';
|
||||||
|
|
||||||
|
class SearchIconWidget extends StatefulWidget {
|
||||||
|
bool openSearch;
|
||||||
|
SearchIconWidget({Key key, this.openSearch = false}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SearchIconWidget> createState() => _SearchIconWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SearchIconWidgetState extends State<SearchIconWidget> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return widget.openSearch
|
||||||
|
? Searchwidget(widget.openSearch)
|
||||||
|
: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
widget.openSearch = !widget.openSearch;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.search),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Searchwidget extends StatefulWidget {
|
||||||
|
bool openSearch;
|
||||||
|
Searchwidget(this.openSearch, {Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<Searchwidget> createState() => _SearchwidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SearchwidgetState extends State<Searchwidget> {
|
||||||
|
TextEditingController searchQuery = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return widget.openSearch
|
||||||
|
? Row(
|
||||||
|
children: [
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Flexible(
|
||||||
|
child: Container(
|
||||||
|
color: Theme.of(context).colorScheme.defaultBackgroundColor,
|
||||||
|
child: TextFormField(
|
||||||
|
style: Theme.of(context).textTheme.subtitle1,
|
||||||
|
controller: searchQuery,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
filled: true,
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 14,
|
||||||
|
),
|
||||||
|
border: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide.none,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
widget.openSearch = !widget.openSearch;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: SearchIconWidget();
|
||||||
|
}
|
||||||
|
}
|
|
@ -224,6 +224,8 @@ String getDayTitle(int timestamp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
String secondsToHHMMSS(int value) {
|
String secondsToHHMMSS(int value) {
|
||||||
|
print("value is ----------------");
|
||||||
|
print(value);
|
||||||
int h, m, s;
|
int h, m, s;
|
||||||
h = value ~/ 3600;
|
h = value ~/ 3600;
|
||||||
m = ((value - h * 3600)) ~/ 60;
|
m = ((value - h * 3600)) ~/ 60;
|
||||||
|
|
Loading…
Reference in a new issue