mirror of
https://github.com/dstark5/Openlib.git
synced 2025-09-21 01:49:32 +08:00
Fixed Empty Search Field Bug
This commit is contained in:
@ -10,15 +10,24 @@ import 'package:openlib/state/state.dart'
|
|||||||
typeValues,
|
typeValues,
|
||||||
sortValues;
|
sortValues;
|
||||||
|
|
||||||
|
import 'components/snack_bar_widget.dart';
|
||||||
|
|
||||||
class SearchPage extends ConsumerWidget {
|
class SearchPage extends ConsumerWidget {
|
||||||
const SearchPage({Key? key}) : super(key: key);
|
const SearchPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
void onSubmit(BuildContext context, WidgetRef ref) {
|
void onSubmit(BuildContext context, WidgetRef ref) {
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) {
|
if(ref.read(searchQueryProvider).isNotEmpty) {
|
||||||
|
Navigator.push(
|
||||||
|
context, MaterialPageRoute(builder: (BuildContext context) {
|
||||||
return ResultPage(
|
return ResultPage(
|
||||||
searchQuery: ref.read(searchQueryProvider),
|
searchQuery: ref.read(searchQueryProvider),
|
||||||
);
|
);
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showSnackBar(context: context, message: 'Search field is empty');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
Reference in New Issue
Block a user