Added beta badge
This commit is contained in:
parent
efcca113c8
commit
e10062206d
|
@ -483,8 +483,9 @@ class _MainAppState extends State<MainApp> {
|
|||
onPressed: () {
|
||||
if (!chatAllowed &&
|
||||
chatUuid ==
|
||||
jsonDecode(item)["uuid"])
|
||||
jsonDecode(item)["uuid"]) {
|
||||
return;
|
||||
}
|
||||
if (!allowMultipleChats) {
|
||||
for (var i = 0;
|
||||
i <
|
||||
|
@ -646,8 +647,9 @@ class _MainAppState extends State<MainApp> {
|
|||
? DismissDirection.startToEnd
|
||||
: DismissDirection.none,
|
||||
confirmDismiss: (direction) async {
|
||||
if (!chatAllowed && chatUuid == jsonDecode(item)["uuid"])
|
||||
if (!chatAllowed && chatUuid == jsonDecode(item)["uuid"]) {
|
||||
return false;
|
||||
}
|
||||
return await deleteChatDialog(context, setState,
|
||||
takeAction: false);
|
||||
},
|
||||
|
|
|
@ -158,6 +158,7 @@ Widget button(String text, IconData? icon, void Function()? onPressed,
|
|||
bool disabled = false,
|
||||
bool replaceIconIfNull = false,
|
||||
String? description,
|
||||
String? badge,
|
||||
void Function()? onDisabledTap,
|
||||
void Function()? onLongTap,
|
||||
void Function()? onDoubleTap}) {
|
||||
|
@ -206,24 +207,43 @@ Widget button(String text, IconData? icon, void Function()? onPressed,
|
|||
(icon != null || replaceIconIfNull)
|
||||
? const SizedBox(width: 16, height: 42)
|
||||
: const SizedBox.shrink(),
|
||||
Expanded(
|
||||
child: (context != null)
|
||||
? RichText(
|
||||
text: TextSpan(
|
||||
text: text,
|
||||
style: DefaultTextStyle.of(context).style.copyWith(
|
||||
color: disabled ? Colors.grey : color),
|
||||
Expanded(child: Builder(builder: (context) {
|
||||
Widget textWidget = Text(text,
|
||||
style: TextStyle(color: disabled ? Colors.grey : color));
|
||||
if (badge != null) {
|
||||
textWidget = Badge(
|
||||
label: Text(badge),
|
||||
offset: const Offset(20, -4),
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
child: textWidget);
|
||||
}
|
||||
if (description == null || description!.startsWith("\n")) {
|
||||
description = description?.removePrefix("\n");
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
(description != null &&
|
||||
desktopLayoutNotRequired(context))
|
||||
? TextSpan(
|
||||
text: description,
|
||||
textWidget,
|
||||
(description != null && desktopLayoutNotRequired(context))
|
||||
? Text(description!,
|
||||
style: const TextStyle(color: Colors.grey))
|
||||
: const TextSpan()
|
||||
]))
|
||||
: Text(text,
|
||||
style:
|
||||
TextStyle(color: disabled ? Colors.grey : color)))
|
||||
: const SizedBox.shrink()
|
||||
]);
|
||||
} else {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
textWidget,
|
||||
(description != null && desktopLayoutNotRequired(context))
|
||||
? Text(description!,
|
||||
style: const TextStyle(color: Colors.grey))
|
||||
: const SizedBox.shrink()
|
||||
]);
|
||||
}
|
||||
}))
|
||||
]),
|
||||
)),
|
||||
);
|
||||
|
@ -544,7 +564,9 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
|||
},
|
||||
context: context,
|
||||
description:
|
||||
"\n${AppLocalizations.of(context)!.settingsDescriptionVoice}")
|
||||
"\n${AppLocalizations.of(context)!.settingsDescriptionVoice}",
|
||||
badge: AppLocalizations.of(context)!
|
||||
.settingsExperimentalBeta)
|
||||
: const SizedBox.shrink(),
|
||||
button(
|
||||
AppLocalizations.of(context)!.settingsTitleExport,
|
||||
|
|
|
@ -66,7 +66,14 @@ class _ScreenSettingsVoiceState extends State<ScreenSettingsVoice> {
|
|||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context)!.settingsTitleVoice)),
|
||||
title: Badge(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.settingsExperimentalBeta),
|
||||
offset: const Offset(20, -4),
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
child:
|
||||
Text(AppLocalizations.of(context)!.settingsTitleVoice))),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: Column(children: [
|
||||
|
|
Loading…
Reference in New Issue