added beta chip, changed things

This commit is contained in:
Kima 2023-08-26 17:21:34 +02:00
parent 1ea0f95863
commit f7d263570d
4 changed files with 86 additions and 51 deletions

View File

@ -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),
),
),
);
}
}

View File

@ -15,6 +15,7 @@ import 'package:filcnaplo/models/user.dart';
import 'package:filcnaplo/theme/colors/colors.dart'; import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo_kreta_api/client/client.dart'; import 'package:filcnaplo_kreta_api/client/client.dart';
import 'package:filcnaplo_mobile_ui/common/action_button.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.dart';
import 'package:filcnaplo_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu_item.dart'; import 'package:filcnaplo_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu_item.dart';
import 'package:filcnaplo_mobile_ui/common/panel/panel.dart'; import 'package:filcnaplo_mobile_ui/common/panel/panel.dart';
@ -157,7 +158,8 @@ class _SettingsScreenState extends State<SettingsScreen>
void initState() { void initState() {
super.initState(); super.initState();
Future.delayed(Duration.zero, () { Future.delayed(Duration.zero, () {
futureRelease = Provider.of<UpdateProvider>(context, listen: false).installedVersion(); futureRelease = Provider.of<UpdateProvider>(context, listen: false)
.installedVersion();
}); });
_hideContainersController = AnimationController( _hideContainersController = AnimationController(
vsync: this, duration: const Duration(milliseconds: 200)); vsync: this, duration: const Duration(milliseconds: 200));
@ -446,50 +448,32 @@ class _SettingsScreenState extends State<SettingsScreen>
contentPadding: const EdgeInsets.only(left: 12.0), contentPadding: const EdgeInsets.only(left: 12.0),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0)), borderRadius: BorderRadius.circular(12.0)),
title: Row(children: [ title: Row(
Icon(FeatherIcons.messageSquare, children: [
color: settings.notificationsEnabled ? Theme.of(context).colorScheme.secondary : AppColors.of(context).text.withOpacity(.25)), Icon(FeatherIcons.messageSquare,
const SizedBox(width: 14.0), color: settings.notificationsEnabled
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
? Theme.of(context).colorScheme.secondary ? Theme.of(context).colorScheme.secondary
: AppColors.of(context).text.withOpacity(.25), : AppColors.of(context)
borderRadius: BorderRadius.circular(40)), .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) => onChanged: (value) =>
settings.update(notificationsEnabled: value), settings.update(notificationsEnabled: value),
), ),
@ -927,7 +911,8 @@ class _SettingsScreenState extends State<SettingsScreen>
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0)), borderRadius: BorderRadius.circular(12.0)),
title: Text("devmode".i18n, title: Text("devmode".i18n,
style: const TextStyle(fontWeight: FontWeight.w500)), style:
const TextStyle(fontWeight: FontWeight.w500)),
onChanged: (v) => onChanged: (v) =>
settings.update(developerMode: false), settings.update(developerMode: false),
value: settings.developerMode, value: settings.developerMode,
@ -1002,8 +987,8 @@ class _SettingsScreenState extends State<SettingsScreen>
if (devmodeCountdown > 0) { if (devmodeCountdown > 0) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar( ScaffoldMessenger.of(context).showSnackBar(SnackBar(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
content: Text( content:
"devmoretaps".i18n.fill([devmodeCountdown])), Text("devmoretaps".i18n.fill([devmodeCountdown])),
)); ));
setState(() => devmodeCountdown--); setState(() => devmodeCountdown--);

View File

@ -163,7 +163,7 @@ extension SettingsLocalization on String {
"theme": "Thema", "theme": "Thema",
"color": "Farbe", "color": "Farbe",
"grade_colors": "Grad Farben", "grade_colors": "Grad Farben",
"notifications": "Benachrichtigungen", "notifications": "Mitteilung",
"news": "Nachrichten", "news": "Nachrichten",
"extras": "Extras", "extras": "Extras",
"about": "Informationen", "about": "Informationen",

View File

@ -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:filcnaplo_premium/ui/mobile/goal_planner/route_option.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:filcnaplo_mobile_ui/common/beta_chip.dart';
enum PlanResult { enum PlanResult {
available, // There are possible solutions available, // There are possible solutions
@ -128,10 +129,18 @@ class _GoalPlannerTestState extends State<GoalPlannerTest> {
const BackButton(), const BackButton(),
Padding( Padding(
padding: const EdgeInsets.only(right: 15.0), padding: const EdgeInsets.only(right: 15.0),
child: Text( child: Row(
'goal_planner_title'.i18n, children: [
style: const TextStyle( Text(
fontWeight: FontWeight.w500, fontSize: 18.0), 'goal_planner_title'.i18n,
style: const TextStyle(
fontWeight: FontWeight.w500, fontSize: 18.0),
),
const SizedBox(
width: 5,
),
const BetaChip(),
],
), ),
), ),
], ],