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