Skip to content

Commit

Permalink
fix some info widgets to be 💅stylish💅 again
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLastGimbus committed Sep 23, 2023
1 parent c95cdfb commit 3b6d4c3
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 81 deletions.
2 changes: 1 addition & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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 👀",
Expand Down
2 changes: 1 addition & 1 deletion lib/l10n/app_pl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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 👀",
Expand Down
10 changes: 7 additions & 3 deletions lib/ui/common/headphones_connection_ensuring_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,20 @@ 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);
final tt = t.textTheme;
final l = AppLocalizations.of(context)!;
return BlocBuilder<HeadphonesConnectionCubit, HeadphonesConnectionState>(
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() ||
Expand Down
43 changes: 21 additions & 22 deletions lib/ui/pages/home/bluetooth_disabled_info_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<HeadphonesConnectionCubit>()
.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<HeadphonesConnectionCubit>()
.openBluetoothSettings(),
child: Text(l.pageHomeBluetoothDisabledOpenSettings),
),
],
),
),
);
}
Expand Down
5 changes: 2 additions & 3 deletions lib/ui/pages/home/no_permission_info_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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: [
Expand Down
53 changes: 29 additions & 24 deletions lib/ui/pages/home/not_paired_info_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,43 @@ 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);

@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<HeadphonesConnectionCubit>()
.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<HeadphonesConnectionCubit>()
.openBluetoothSettings(),
),
const SizedBox(height: 16),
TextButton(
child: Text(l.pageHomeNotPairedPairOpenDemo),
onPressed: () => launchUrlString(
'https://freebuddy-web-demo.netlify.app/',
mode: LaunchMode.externalApplication,
),
)
],
),
),
);
}
Expand Down
27 changes: 0 additions & 27 deletions lib/ui/pages/pretty_rounded_container_widget.dart

This file was deleted.

0 comments on commit 3b6d4c3

Please sign in to comment.