diff options
author | Lisandro Pérez Meyer <lpmeyer@ics.com> | 2023-11-14 17:20:58 -0300 |
---|---|---|
committer | Lisandro Pérez Meyer <lpmeyer@ics.com> | 2023-11-14 17:31:12 -0300 |
commit | 70ec8a79a121471a004e7e4c23157d10157e136f (patch) | |
tree | a4f9c0a4fac4e4274ec4324a289b6ef62e1c5653 /lib/presentation/common_widget/custom_top_bar.dart |
Initial cleanup push.
Based on agldemo2024 on commit 2a5dc04d801134338150c3f6afc67eaa65599763
Disable device preview.
Disable Lottie animation.
The original commit was b3c493c340fcb4bb0a937692838fc830bec3e9ea
but I am just keeping this change, because the json did not really
needed to change. I think.
Signed-off-by: Lisandro Pérez Meyer <lpmeyer@ics.com>
Diffstat (limited to 'lib/presentation/common_widget/custom_top_bar.dart')
-rw-r--r-- | lib/presentation/common_widget/custom_top_bar.dart | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/lib/presentation/common_widget/custom_top_bar.dart b/lib/presentation/common_widget/custom_top_bar.dart new file mode 100644 index 0000000..c268f53 --- /dev/null +++ b/lib/presentation/common_widget/custom_top_bar.dart @@ -0,0 +1,106 @@ +import 'package:intl/intl.dart'; + +import '../../export.dart'; + +class CustomTopBar extends ConsumerStatefulWidget + implements PreferredSizeWidget { + const CustomTopBar({super.key}); + + @override + CustomTopBarState createState() => CustomTopBarState(); + + @override + Size get preferredSize => const Size.fromHeight(80); +} + +class CustomTopBarState extends ConsumerState<CustomTopBar> { + @override + Widget build(BuildContext context) { + final singnalsConnection = + ref.watch(signalsProvider.select((sinals) => sinals)); + final user = ref.watch(usersProvider.select((user) => user)); + final time2 = + ref.watch(dateTimeStateProvider.select((dateTime) => dateTime)); + + DateFormat dateFormat = DateFormat('HH:mm'); + //var time = dateFormat.format(DateTime.now()); + var time = time2.time; + + return AppBar( + elevation: 0, + backgroundColor: Colors.transparent, + //leadingWidth: 100, + + title: Stack( + //mainAxisAlignment: MainAxisAlignment.center, + children: [ + Positioned.fill( + child: Align( + alignment: Alignment.centerLeft, + child: Wrap( + children: [ + RichText( + text: TextSpan( + text: '$time ', + style: const TextStyle(color: Colors.white, fontSize: 26), + children: <InlineSpan>[ + const WidgetSpan( + child: SizedBox(width: 16), // 16px space + ), + TextSpan( + text: user.selectedUser.name, + style: const TextStyle(fontWeight: FontWeight.bold), + ), + ], + ), + ), + ], + ), + ), + ), + Align( + alignment: Alignment.center, + child: Image.asset( + 'assets/topBarLogo.png', + width: 659, + height: 56, + ), + ), + Positioned.fill( + child: Align( + alignment: Alignment.centerRight, + child: Wrap( + children: [ + Icon( + singnalsConnection.isBluetoothConnected + ? Icons.bluetooth + : Icons.bluetooth_disabled, + size: 24, + ), + const SizedBox( + width: 24, + ), + const Icon( + Icons.signal_cellular_4_bar_outlined, + size: 24, + ), + const SizedBox( + width: 24, + ), + Icon( + singnalsConnection.isWifiConnected + ? Icons.wifi + : Icons.wifi_off, + size: 24, + ), + ], + ), + ), + ), + ], + ), + + // ), + ); + } +} |