diff --git a/filcnaplo_mobile_ui/lib/common/beta_chip.dart b/filcnaplo_mobile_ui/lib/common/beta_chip.dart new file mode 100644 index 0000000..9b4c0e8 --- /dev/null +++ b/filcnaplo_mobile_ui/lib/common/beta_chip.dart @@ -0,0 +1,41 @@ +import 'package:filcnaplo/theme/colors/colors.dart'; +import 'package:flutter/material.dart'; + +class BetaChip extends StatelessWidget { + const BetaChip({Key? key, this.disabled = false}) : super(key: key); + + final bool disabled; + + @override + Widget build(BuildContext context) { + return SizedBox( + height: 25, + child: AnimatedContainer( + duration: const Duration(milliseconds: 200), + child: Padding( + padding: const EdgeInsets.only(left: 8, right: 8), + child: Center( + child: Text( + "BETA", + softWrap: true, + style: TextStyle( + fontSize: 10, + color: disabled + ? AppColors.of(context).text.withOpacity(.5) + : Colors.white, + fontWeight: FontWeight.w600, + overflow: TextOverflow.ellipsis, + ), + ), + ), + ), + decoration: BoxDecoration( + color: !disabled + ? Theme.of(context).colorScheme.secondary + : AppColors.of(context).text.withOpacity(.25), + borderRadius: BorderRadius.circular(40), + ), + ), + ); + } +} diff --git a/filcnaplo_mobile_ui/lib/screens/settings/settings_screen.dart b/filcnaplo_mobile_ui/lib/screens/settings/settings_screen.dart index 119819b..2eca057 100755 --- a/filcnaplo_mobile_ui/lib/screens/settings/settings_screen.dart +++ b/filcnaplo_mobile_ui/lib/screens/settings/settings_screen.dart @@ -15,6 +15,7 @@ import 'package:filcnaplo/models/user.dart'; import 'package:filcnaplo/theme/colors/colors.dart'; import 'package:filcnaplo_kreta_api/client/client.dart'; import 'package:filcnaplo_mobile_ui/common/action_button.dart'; +import 'package:filcnaplo_mobile_ui/common/beta_chip.dart'; import 'package:filcnaplo_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu.dart'; import 'package:filcnaplo_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu_item.dart'; import 'package:filcnaplo_mobile_ui/common/panel/panel.dart'; @@ -157,7 +158,8 @@ class _SettingsScreenState extends State void initState() { super.initState(); Future.delayed(Duration.zero, () { - futureRelease = Provider.of(context, listen: false).installedVersion(); + futureRelease = Provider.of(context, listen: false) + .installedVersion(); }); _hideContainersController = AnimationController( vsync: this, duration: const Duration(milliseconds: 200)); @@ -446,50 +448,32 @@ class _SettingsScreenState extends State contentPadding: const EdgeInsets.only(left: 12.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12.0)), - title: Row(children: [ - Icon(FeatherIcons.messageSquare, - color: settings.notificationsEnabled ? Theme.of(context).colorScheme.secondary : AppColors.of(context).text.withOpacity(.25)), - const SizedBox(width: 14.0), - Text( - "notifications".i18n, - style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settings.notificationsEnabled ? 1.0 : .5), - fontWeight: FontWeight.w600, - fontSize: 16.0, - ), - ), - const SizedBox( - width: 5, - ), - SizedBox( - height: 30, - child: AnimatedContainer( - duration: const Duration(milliseconds: 200), - child: Padding( - padding: - const EdgeInsets.only(left: 10, right: 10), - child: Center( - child: Text("BETA", - style: TextStyle( - fontSize: 9.1, - color: AppColors.of(context) - .text - .withOpacity( - settings.notificationsEnabled - ? 1.0 - : .5), - fontWeight: FontWeight.w600, - overflow: TextOverflow.ellipsis))), - ), - decoration: BoxDecoration( - color: settings.notificationsEnabled + title: Row( + children: [ + Icon(FeatherIcons.messageSquare, + color: settings.notificationsEnabled ? Theme.of(context).colorScheme.secondary - : AppColors.of(context).text.withOpacity(.25), - borderRadius: BorderRadius.circular(40)), + : AppColors.of(context) + .text + .withOpacity(.25)), + const SizedBox(width: 14.0), + Text( + "notifications".i18n, + style: TextStyle( + color: AppColors.of(context).text.withOpacity( + settings.notificationsEnabled ? 1.0 : .5), + fontWeight: FontWeight.w600, + fontSize: 16.0, + ), ), - ) - ]), + const SizedBox( + width: 5, + ), + BetaChip( + disabled: !settings.notificationsEnabled, + ), + ], + ), onChanged: (value) => settings.update(notificationsEnabled: value), ), @@ -927,7 +911,8 @@ class _SettingsScreenState extends State shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12.0)), title: Text("devmode".i18n, - style: const TextStyle(fontWeight: FontWeight.w500)), + style: + const TextStyle(fontWeight: FontWeight.w500)), onChanged: (v) => settings.update(developerMode: false), value: settings.developerMode, @@ -1002,8 +987,8 @@ class _SettingsScreenState extends State if (devmodeCountdown > 0) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( duration: const Duration(milliseconds: 200), - content: Text( - "devmoretaps".i18n.fill([devmodeCountdown])), + content: + Text("devmoretaps".i18n.fill([devmodeCountdown])), )); setState(() => devmodeCountdown--); diff --git a/filcnaplo_mobile_ui/lib/screens/settings/settings_screen.i18n.dart b/filcnaplo_mobile_ui/lib/screens/settings/settings_screen.i18n.dart index ae7f40d..8c6336b 100755 --- a/filcnaplo_mobile_ui/lib/screens/settings/settings_screen.i18n.dart +++ b/filcnaplo_mobile_ui/lib/screens/settings/settings_screen.i18n.dart @@ -163,7 +163,7 @@ extension SettingsLocalization on String { "theme": "Thema", "color": "Farbe", "grade_colors": "Grad Farben", - "notifications": "Benachrichtigungen", + "notifications": "Mitteilung", "news": "Nachrichten", "extras": "Extras", "about": "Informationen", diff --git a/filcnaplo_premium/lib/ui/mobile/goal_planner/test.dart b/filcnaplo_premium/lib/ui/mobile/goal_planner/test.dart index 626cdcb..7327b9e 100644 --- a/filcnaplo_premium/lib/ui/mobile/goal_planner/test.dart +++ b/filcnaplo_premium/lib/ui/mobile/goal_planner/test.dart @@ -10,6 +10,7 @@ import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_planner_screen.i18 import 'package:filcnaplo_premium/ui/mobile/goal_planner/route_option.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:filcnaplo_mobile_ui/common/beta_chip.dart'; enum PlanResult { available, // There are possible solutions @@ -128,10 +129,18 @@ class _GoalPlannerTestState extends State { const BackButton(), Padding( padding: const EdgeInsets.only(right: 15.0), - child: Text( - 'goal_planner_title'.i18n, - style: const TextStyle( - fontWeight: FontWeight.w500, fontSize: 18.0), + child: Row( + children: [ + Text( + 'goal_planner_title'.i18n, + style: const TextStyle( + fontWeight: FontWeight.w500, fontSize: 18.0), + ), + const SizedBox( + width: 5, + ), + const BetaChip(), + ], ), ), ],