mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-15 18:25:59 -07:00
feat: Implement custom keyboard for Android TV (#523)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
721fc28060
commit
75c2f958b4
22 changed files with 927 additions and 157 deletions
|
|
@ -13,6 +13,7 @@ import 'package:fladder/screens/login/login_user_grid.dart';
|
|||
import 'package:fladder/screens/shared/animated_fade_size.dart';
|
||||
import 'package:fladder/screens/shared/fladder_logo.dart';
|
||||
import 'package:fladder/util/adaptive_layout/adaptive_layout.dart';
|
||||
import 'package:fladder/widgets/keyboard/custom_keyboard.dart';
|
||||
import 'package:fladder/widgets/navigation_scaffold/components/fladder_app_bar.dart';
|
||||
|
||||
@RoutePage()
|
||||
|
|
@ -42,52 +43,54 @@ class _LoginPageState extends ConsumerState<LoginScreen> {
|
|||
Widget build(BuildContext context) {
|
||||
final screen = ref.watch(authProvider.select((value) => value.screen));
|
||||
final accounts = ref.watch(authProvider.select((value) => value.accounts));
|
||||
return Scaffold(
|
||||
appBar: const FladderAppBar(),
|
||||
extendBody: true,
|
||||
extendBodyBehindAppBar: true,
|
||||
floatingActionButton: switch (screen) {
|
||||
LoginScreenType.users => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
spacing: 16,
|
||||
children: [
|
||||
if (!AdaptiveLayout.of(context).isDesktop)
|
||||
return CustomKeyboardWrapper(
|
||||
child: Scaffold(
|
||||
appBar: const FladderAppBar(),
|
||||
extendBody: true,
|
||||
extendBodyBehindAppBar: true,
|
||||
floatingActionButton: switch (screen) {
|
||||
LoginScreenType.users => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
spacing: 16,
|
||||
children: [
|
||||
if (!AdaptiveLayout.of(context).isDesktop)
|
||||
FloatingActionButton(
|
||||
key: const Key("edit_user_button"),
|
||||
heroTag: "edit_user_button",
|
||||
backgroundColor: editUsersMode ? Theme.of(context).colorScheme.errorContainer : null,
|
||||
child: const Icon(IconsaxPlusLinear.edit_2),
|
||||
onPressed: () => setState(() => editUsersMode = !editUsersMode),
|
||||
),
|
||||
FloatingActionButton(
|
||||
key: const Key("edit_user_button"),
|
||||
heroTag: "edit_user_button",
|
||||
backgroundColor: editUsersMode ? Theme.of(context).colorScheme.errorContainer : null,
|
||||
child: const Icon(IconsaxPlusLinear.edit_2),
|
||||
onPressed: () => setState(() => editUsersMode = !editUsersMode),
|
||||
key: const Key("new_user_button"),
|
||||
heroTag: "new_user_button",
|
||||
child: const Icon(IconsaxPlusLinear.add_square),
|
||||
onPressed: () => ref.read(authProvider.notifier).addNewUser(),
|
||||
),
|
||||
FloatingActionButton(
|
||||
key: const Key("new_user_button"),
|
||||
heroTag: "new_user_button",
|
||||
child: const Icon(IconsaxPlusLinear.add_square),
|
||||
onPressed: () => ref.read(authProvider.notifier).addNewUser(),
|
||||
),
|
||||
],
|
||||
),
|
||||
_ => null,
|
||||
},
|
||||
body: Center(
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
padding: MediaQuery.paddingOf(context).add(const EdgeInsetsGeometry.all(16)),
|
||||
children: [
|
||||
const FladderLogo(),
|
||||
const SizedBox(height: 24),
|
||||
AnimatedFadeSize(
|
||||
child: switch (screen) {
|
||||
LoginScreenType.login || LoginScreenType.code => const LoginScreenCredentials(),
|
||||
_ => LoginUserGrid(
|
||||
users: accounts,
|
||||
editMode: editUsersMode,
|
||||
onPressed: (user) => tapLoggedInAccount(context, user, ref),
|
||||
onLongPress: (user) => openUserEditDialogue(context, user),
|
||||
),
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
_ => null,
|
||||
},
|
||||
body: Center(
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
padding: MediaQuery.paddingOf(context).add(const EdgeInsetsGeometry.all(16)),
|
||||
children: [
|
||||
const FladderLogo(),
|
||||
const SizedBox(height: 24),
|
||||
AnimatedFadeSize(
|
||||
child: switch (screen) {
|
||||
LoginScreenType.login || LoginScreenType.code => const LoginScreenCredentials(),
|
||||
_ => LoginUserGrid(
|
||||
users: accounts,
|
||||
editMode: editUsersMode,
|
||||
onPressed: (user) => tapLoggedInAccount(context, user, ref),
|
||||
onLongPress: (user) => openUserEditDialogue(context, user),
|
||||
),
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue