Skip to content

Commit

Permalink
draw attention to gear scan button when no gear known
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed May 29, 2024
1 parent cc79ab9 commit c9fbf51
Showing 1 changed file with 49 additions and 46 deletions.
95 changes: 49 additions & 46 deletions lib/Frontend/Widgets/known_gear.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>(begin: 0, end: 1) : Tween<double>(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,
),
],
);
},
);
},
);
},
),
);
),
],
);
},
);
},
);
},
),);
}
}

Expand Down

0 comments on commit c9fbf51

Please sign in to comment.