From 3b6d4c310a6ae5bb63ef839f600446b8b8b10e2d Mon Sep 17 00:00:00 2001 From: TheLastGimbus Date: Sat, 23 Sep 2023 21:56:26 +0200 Subject: [PATCH] =?UTF-8?q?fix=20some=20info=20widgets=20to=20be=20?= =?UTF-8?q?=F0=9F=92=85stylish=F0=9F=92=85=20again?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/l10n/app_en.arb | 2 +- lib/l10n/app_pl.arb | 2 +- ...eadphones_connection_ensuring_overlay.dart | 10 ++-- .../home/bluetooth_disabled_info_widget.dart | 43 ++++++++------- .../pages/home/no_permission_info_widget.dart | 5 +- lib/ui/pages/home/not_paired_info_widget.dart | 53 ++++++++++--------- .../pretty_rounded_container_widget.dart | 27 ---------- 7 files changed, 61 insertions(+), 81 deletions(-) delete mode 100644 lib/ui/pages/pretty_rounded_container_widget.dart diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index e9dac50..2920217 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -19,7 +19,7 @@ "pageHomeBluetoothDisabledEnable": "Enable ☝", "pageHomeBluetoothDisabledOpenSettings": "Open settings to enable 💙", "pageHomeNotPaired": "You don't have Freebuds 4i paired to your phone 😿", - "pageHomeNotPairedPairOpenSettings": "Open bluetooth settings to pair 💙", + "pageHomeNotPairedPairOpenSettings": "Open bluetooth settings to pair 🔌", "pageHomeNotPairedPairOpenDemo": "Try app without headphones 🌐", "pageHomeConnectedClosed": "Headphones are connected, but not with FreeBuddy 🤨", "pageHomeConnectedClosedDesc": "You probably opened another app - connect again 👀", diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 2ca3eb0..d413828 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -19,7 +19,7 @@ "pageHomeBluetoothDisabledEnable": "Włącz ☝", "pageHomeBluetoothDisabledOpenSettings": "Otwórz ustawienia żeby włączyć 💙", "pageHomeNotPaired": "Nie masz sparowanych Freebuds 4i z telefonem 😿", - "pageHomeNotPairedPairOpenSettings": "Otwórz ustawienia bluetooth żeby sparować 💙", + "pageHomeNotPairedPairOpenSettings": "Otwórz ustawienia bluetooth żeby sparować 🔌", "pageHomeNotPairedPairOpenDemo": "Wypróbuj apke bez słuchawek 🌐", "pageHomeConnectedClosed": "Słuchawki są połączone, ale nie z FreeBuddy 🤨", "pageHomeConnectedClosedDesc": "Pewnie otworzyłeś inną apke - połącz spowrotem 👀", diff --git a/lib/ui/common/headphones_connection_ensuring_overlay.dart b/lib/ui/common/headphones_connection_ensuring_overlay.dart index 1f8a241..2881ba4 100644 --- a/lib/ui/common/headphones_connection_ensuring_overlay.dart +++ b/lib/ui/common/headphones_connection_ensuring_overlay.dart @@ -34,6 +34,9 @@ class HeadphonesConnectionEnsuringOverlay extends StatelessWidget { const HeadphonesConnectionEnsuringOverlay({Key? key, required this.builder}) : super(key: key); + Widget _padded(Widget child) => + Padding(padding: const EdgeInsets.all(16), child: child); + @override Widget build(BuildContext context) { final t = Theme.of(context); @@ -41,9 +44,10 @@ class HeadphonesConnectionEnsuringOverlay extends StatelessWidget { final l = AppLocalizations.of(context)!; return BlocBuilder( builder: (context, state) => switch (state) { - HeadphonesNoPermission() => const NoPermissionInfoWidget(), - HeadphonesNotPaired() => const NotPairedInfoWidget(), - HeadphonesBluetoothDisabled() => const BluetoothDisabledInfoWidget(), + HeadphonesNoPermission() => _padded(const NoPermissionInfoWidget()), + HeadphonesNotPaired() => _padded(const NotPairedInfoWidget()), + HeadphonesBluetoothDisabled() => + _padded(const BluetoothDisabledInfoWidget()), // We know that we *have* the headphones, but not necessary connected HeadphonesDisconnected() || HeadphonesConnecting() || diff --git a/lib/ui/pages/home/bluetooth_disabled_info_widget.dart b/lib/ui/pages/home/bluetooth_disabled_info_widget.dart index b5ae661..c97cddc 100644 --- a/lib/ui/pages/home/bluetooth_disabled_info_widget.dart +++ b/lib/ui/pages/home/bluetooth_disabled_info_widget.dart @@ -3,7 +3,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../../../headphones/cubit/headphones_connection_cubit.dart'; -import '../pretty_rounded_container_widget.dart'; class BluetoothDisabledInfoWidget extends StatelessWidget { const BluetoothDisabledInfoWidget({Key? key}) : super(key: key); @@ -13,31 +12,31 @@ class BluetoothDisabledInfoWidget extends StatelessWidget { final l = AppLocalizations.of(context)!; final t = Theme.of(context); final tt = t.textTheme; - return PrettyRoundedContainerWidget( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( + return Card( + child: Padding( + padding: const EdgeInsets.all(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( l.pageHomeBluetoothDisabled, style: tt.displaySmall, textAlign: TextAlign.center, ), - ), - const SizedBox(height: 16), - // the_last_bluetooth plugin doesn't support this for now - // TextButton( - // onPressed: onEnable, - // child: Text(l.pageHomeBluetoothDisabledEnable), - // ), - FilledButton( - onPressed: () => context - .read() - .openBluetoothSettings(), - child: Text(l.pageHomeBluetoothDisabledOpenSettings), - ), - ], + const SizedBox(height: 16), + // the_last_bluetooth plugin doesn't support this for now + // TextButton( + // onPressed: onEnable, + // child: Text(l.pageHomeBluetoothDisabledEnable), + // ), + FilledButton( + onPressed: () => context + .read() + .openBluetoothSettings(), + child: Text(l.pageHomeBluetoothDisabledOpenSettings), + ), + ], + ), ), ); } diff --git a/lib/ui/pages/home/no_permission_info_widget.dart b/lib/ui/pages/home/no_permission_info_widget.dart index 0349616..ae6c9a3 100644 --- a/lib/ui/pages/home/no_permission_info_widget.dart +++ b/lib/ui/pages/home/no_permission_info_widget.dart @@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../../../headphones/cubit/headphones_connection_cubit.dart'; -import '../pretty_rounded_container_widget.dart'; class NoPermissionInfoWidget extends StatelessWidget { const NoPermissionInfoWidget({Key? key}) : super(key: key); @@ -14,9 +13,9 @@ class NoPermissionInfoWidget extends StatelessWidget { final l = AppLocalizations.of(context)!; final t = Theme.of(context); final tt = t.textTheme; - return PrettyRoundedContainerWidget( + return Card( child: Padding( - padding: const EdgeInsets.all(16.0), + padding: const EdgeInsets.all(12), child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/ui/pages/home/not_paired_info_widget.dart b/lib/ui/pages/home/not_paired_info_widget.dart index 4ce7dc8..4d65246 100644 --- a/lib/ui/pages/home/not_paired_info_widget.dart +++ b/lib/ui/pages/home/not_paired_info_widget.dart @@ -4,7 +4,6 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:url_launcher/url_launcher_string.dart'; import '../../../headphones/cubit/headphones_connection_cubit.dart'; -import '../pretty_rounded_container_widget.dart'; class NotPairedInfoWidget extends StatelessWidget { const NotPairedInfoWidget({Key? key}) : super(key: key); @@ -12,30 +11,36 @@ class NotPairedInfoWidget extends StatelessWidget { @override Widget build(BuildContext context) { final l = AppLocalizations.of(context)!; - return PrettyRoundedContainerWidget( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text(l.pageHomeNotPaired, textAlign: TextAlign.center), - ), - const SizedBox(height: 16), - ElevatedButton( - child: Text(l.pageHomeNotPairedPairOpenSettings), - onPressed: () => context - .read() - .openBluetoothSettings(), - ), - const SizedBox(height: 16), - TextButton( - child: Text(l.pageHomeNotPairedPairOpenDemo), - onPressed: () => launchUrlString( - 'https://freebuddy-web-demo.netlify.app/', - mode: LaunchMode.externalApplication, + final t = Theme.of(context); + final tt = t.textTheme; + return Card( + child: Padding( + padding: const EdgeInsets.all(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + l.pageHomeNotPaired, + style: tt.bodyLarge, + textAlign: TextAlign.center, ), - ) - ], + const SizedBox(height: 16), + FilledButton( + child: Text(l.pageHomeNotPairedPairOpenSettings), + onPressed: () => context + .read() + .openBluetoothSettings(), + ), + const SizedBox(height: 16), + TextButton( + child: Text(l.pageHomeNotPairedPairOpenDemo), + onPressed: () => launchUrlString( + 'https://freebuddy-web-demo.netlify.app/', + mode: LaunchMode.externalApplication, + ), + ) + ], + ), ), ); } diff --git a/lib/ui/pages/pretty_rounded_container_widget.dart b/lib/ui/pages/pretty_rounded_container_widget.dart deleted file mode 100644 index 4c5e8c5..0000000 --- a/lib/ui/pages/pretty_rounded_container_widget.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:flutter/material.dart'; - -class PrettyRoundedContainerWidget extends StatelessWidget { - final Widget child; - - const PrettyRoundedContainerWidget({Key? key, required this.child}) - : super(key: key); - - @override - Widget build(BuildContext context) { - final t = Theme.of(context); - return Container( - padding: const EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: t.colorScheme.surface, - borderRadius: BorderRadius.circular(8.0), - boxShadow: [ - BoxShadow( - color: t.colorScheme.shadow, - blurRadius: 8, - ), - ], - ), - child: child, - ); - } -}