From c9fbf51f4f79519e0c409bdf6d1a1788b9dc07d4 Mon Sep 17 00:00:00 2001 From: Codel1417 Date: Wed, 29 May 2024 17:09:03 -0400 Subject: [PATCH] draw attention to gear scan button when no gear known --- lib/Frontend/Widgets/known_gear.dart | 95 ++++++++++++++-------------- 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/lib/Frontend/Widgets/known_gear.dart b/lib/Frontend/Widgets/known_gear.dart index 6e7f8732..17360da1 100644 --- a/lib/Frontend/Widgets/known_gear.dart +++ b/lib/Frontend/Widgets/known_gear.dart @@ -40,57 +40,60 @@ class ScanForNewGearButton extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - return Card( - clipBehavior: Clip.antiAlias, - child: InkWell( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: SizedBox( - height: 50 * MediaQuery.textScalerOf(context).scale(1), - width: ref.watch(knownDevicesProvider).values.length > 1 ? 100 * MediaQuery.textScalerOf(context).scale(1) : 200 * MediaQuery.textScalerOf(context).scale(1), - child: Center( - child: Text( - scanDevicesTitle(), - textAlign: TextAlign.center, - ), + return TweenAnimationBuilder(tween: ref.watch(knownDevicesProvider).isEmpty ? Tween(begin: 0, end: 1) : Tween(begin: 1, end: 0), duration: animationTransitionDuration, builder: (context, value, child) { + return Card( + clipBehavior: Clip.antiAlias, + color: Color.lerp(Theme.of(context).cardColor, Theme.of(context).primaryColor, value), + child:child , + ); + },child: InkWell( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: 50 * MediaQuery.textScalerOf(context).scale(1), + width: ref.watch(knownDevicesProvider).values.length > 1 ? 100 * MediaQuery.textScalerOf(context).scale(1) : 200 * MediaQuery.textScalerOf(context).scale(1), + child: Center( + child: Text( + scanDevicesTitle(), + textAlign: TextAlign.center, ), ), ), - onTap: () { - plausible.event(page: "Scan For New Gear"); - showModalBottomSheet( - context: context, - showDragHandle: true, - isScrollControlled: true, - enableDrag: true, - isDismissible: true, - builder: (BuildContext context) { - return DraggableScrollableSheet( - initialChildSize: 0.5, - expand: false, - builder: (BuildContext context, ScrollController scrollController) { - return Column( - children: [ - ListTile( - title: Text( - scanDevicesTitle(), - style: Theme.of(context).textTheme.titleLarge, - ), + ), + onTap: () { + plausible.event(page: "Scan For New Gear"); + showModalBottomSheet( + context: context, + showDragHandle: true, + isScrollControlled: true, + enableDrag: true, + isDismissible: true, + builder: (BuildContext context) { + return DraggableScrollableSheet( + initialChildSize: 0.5, + expand: false, + builder: (BuildContext context, ScrollController scrollController) { + return Column( + children: [ + ListTile( + title: Text( + scanDevicesTitle(), + style: Theme.of(context).textTheme.titleLarge, ), - Expanded( - child: ScanForNewDevice( - scrollController: scrollController, - ), + ), + Expanded( + child: ScanForNewDevice( + scrollController: scrollController, ), - ], - ); - }, - ); - }, - ); - }, - ), - ); + ), + ], + ); + }, + ); + }, + ); + }, + ),); } }