Add keyboard dismisser
This commit is contained in:
parent
0889246956
commit
9fa198c3bb
|
@ -3,6 +3,7 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:keyboard_dismisser/keyboard_dismisser.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'hooks/stores.dart';
|
||||
|
@ -41,15 +42,17 @@ class MyApp extends HookWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final configStore = useConfigStore();
|
||||
|
||||
return MaterialApp(
|
||||
title: 'lemmur',
|
||||
supportedLocales: L10n.supportedLocales,
|
||||
localizationsDelegates: L10n.localizationsDelegates,
|
||||
themeMode: configStore.theme,
|
||||
darkTheme: configStore.amoledDarkMode ? amoledTheme : darkTheme,
|
||||
locale: configStore.locale,
|
||||
theme: lightTheme,
|
||||
home: const MyHomePage(),
|
||||
return KeyboardDismisser(
|
||||
child: MaterialApp(
|
||||
title: 'lemmur',
|
||||
supportedLocales: L10n.supportedLocales,
|
||||
localizationsDelegates: L10n.localizationsDelegates,
|
||||
themeMode: configStore.theme,
|
||||
darkTheme: configStore.amoledDarkMode ? amoledTheme : darkTheme,
|
||||
locale: configStore.locale,
|
||||
theme: lightTheme,
|
||||
home: const MyHomePage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,45 +33,42 @@ class SearchTab extends HookWidget {
|
|||
|
||||
return Scaffold(
|
||||
appBar: AppBar(),
|
||||
body: GestureDetector(
|
||||
onTapDown: (_) => primaryFocus?.unfocus(),
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
children: [
|
||||
TextField(
|
||||
controller: searchInputController,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: InputDecoration(hintText: L10n.of(context)!.search),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text('instance:',
|
||||
style: Theme.of(context).textTheme.subtitle1),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
children: [
|
||||
TextField(
|
||||
controller: searchInputController,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: InputDecoration(hintText: L10n.of(context)!.search),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text('instance:',
|
||||
style: Theme.of(context).textTheme.subtitle1),
|
||||
),
|
||||
Expanded(
|
||||
child: RadioPicker<String>(
|
||||
values: accStore.instances.toList(),
|
||||
groupValue: instanceHost.value!,
|
||||
onChanged: (value) => instanceHost.value = value,
|
||||
),
|
||||
Expanded(
|
||||
child: RadioPicker<String>(
|
||||
values: accStore.instances.toList(),
|
||||
groupValue: instanceHost.value!,
|
||||
onChanged: (value) => instanceHost.value = value,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (searchInputController.text.isNotEmpty)
|
||||
ElevatedButton(
|
||||
onPressed: () => goTo(
|
||||
context,
|
||||
(c) => SearchResultsPage(
|
||||
instanceHost: instanceHost.value!,
|
||||
query: searchInputController.text,
|
||||
)),
|
||||
child: Text(L10n.of(context)!.search),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (searchInputController.text.isNotEmpty)
|
||||
ElevatedButton(
|
||||
onPressed: () => goTo(
|
||||
context,
|
||||
(c) => SearchResultsPage(
|
||||
instanceHost: instanceHost.value!,
|
||||
query: searchInputController.text,
|
||||
)),
|
||||
child: Text(L10n.of(context)!.search),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -392,6 +392,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.1.0"
|
||||
keyboard_dismisser:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: keyboard_dismisser
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
latinize:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -47,6 +47,7 @@ dependencies:
|
|||
intl: ^0.17.0
|
||||
matrix4_transform: ^2.0.0
|
||||
json_annotation: ^4.0.1
|
||||
keyboard_dismisser: ^2.0.0
|
||||
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
|
Loading…
Reference in New Issue