Removed modal style

This commit is contained in:
JHubi1 2024-08-22 23:07:27 +02:00
parent a69622250b
commit a9fed3e36d
No known key found for this signature in database
GPG Key ID: 7BF82570CBBBD050
5 changed files with 327 additions and 343 deletions

View File

@ -536,12 +536,6 @@ class _MainAppState extends State<MainApp> {
} }
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
barrierColor: (Theme.of(context)
.brightness ==
Brightness.dark)
? Colors.grey
.withOpacity(0.2)
: null,
builder: (context) { builder: (context) {
return Container( return Container(
padding: padding:
@ -1266,11 +1260,6 @@ class _MainAppState extends State<MainApp> {
} }
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
barrierColor:
(Theme.of(context).brightness ==
Brightness.dark)
? Colors.grey.withOpacity(0.2)
: null,
builder: (context) { builder: (context) {
return Container( return Container(
width: double.infinity, width: double.infinity,

View File

@ -54,10 +54,7 @@ Widget toggle(BuildContext context, String text, bool value,
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: (icon == null) ? 16 : 32, right: 16, top: 12), left: (icon == null) ? 16 : 32, right: 16, top: 12),
child: Divider( child: Divider(color: Theme.of(context).dividerColor)),
color: (Theme.of(context).brightness == Brightness.light)
? Colors.grey[300]
: Colors.grey[900])),
Row(mainAxisSize: MainAxisSize.max, children: [ Row(mainAxisSize: MainAxisSize.max, children: [
(icon != null) (icon != null)
? Padding( ? Padding(
@ -366,328 +363,341 @@ class _ScreenSettingsState extends State<ScreenSettings> {
child: SizedBox(height: 200, child: MoveWindow())) child: SizedBox(height: 200, child: MoveWindow()))
]), ]),
actions: desktopControlsActions(context)), actions: desktopControlsActions(context)),
body: Padding( body: Center(
padding: const EdgeInsets.only(left: 16, right: 16), child: Container(
child: LayoutBuilder(builder: (context, constraints) { constraints: const BoxConstraints(maxWidth: 1200),
var column1 = padding: const EdgeInsets.only(left: 16, right: 16),
Column(mainAxisSize: MainAxisSize.min, children: [ child: LayoutBuilder(builder: (context, constraints) {
AnimatedContainer( var column1 =
duration: const Duration(milliseconds: 200), Column(mainAxisSize: MainAxisSize.min, children: [
height: animatedDesktop ? 8 : 0, AnimatedContainer(
child: const SizedBox.shrink()), duration: const Duration(milliseconds: 200),
const SizedBox(height: 8), height: animatedDesktop ? 8 : 0,
TextField( child: const SizedBox.shrink()),
controller: hostInputController, const SizedBox(height: 8),
keyboardType: TextInputType.url, TextField(
autofillHints: const [AutofillHints.url], controller: hostInputController,
readOnly: useHost, keyboardType: TextInputType.url,
onSubmitted: (value) { autofillHints: const [AutofillHints.url],
selectionHaptic(); readOnly: useHost,
checkHost(); onSubmitted: (value) {
}, selectionHaptic();
decoration: InputDecoration( checkHost();
labelText: },
AppLocalizations.of(context)!.settingsHost, decoration: InputDecoration(
hintText: "http://localhost:11434", labelText: AppLocalizations.of(context)!
prefixIcon: IconButton( .settingsHost,
tooltip: AppLocalizations.of(context)! hintText: "http://localhost:11434",
.tooltipAddHostHeaders, prefixIcon: IconButton(
onPressed: () async { tooltip: AppLocalizations.of(context)!
selectionHaptic(); .tooltipAddHostHeaders,
String tmp = await prompt(context, onPressed: () async {
placeholder: selectionHaptic();
"{\"Authorization\": \"Bearer ...\"}", String tmp = await prompt(context,
title: AppLocalizations.of(context)! placeholder:
.settingsHostHeaderTitle, "{\"Authorization\": \"Bearer ...\"}",
value: (prefs! title: AppLocalizations.of(context)!
.getString("hostHeaders") ?? .settingsHostHeaderTitle,
""), value: (prefs!
valueIfCanceled: "{}", .getString("hostHeaders") ??
validator: (content) async { ""),
try { valueIfCanceled: "{}",
var tmp = jsonDecode(content); validator: (content) async {
tmp as Map<String, dynamic>; try {
return true; var tmp = jsonDecode(content);
} catch (_) { tmp as Map<String, dynamic>;
return false; return true;
} } catch (_) {
}, return false;
validatorError: }
AppLocalizations.of(context)! },
.settingsHostHeaderInvalid, validatorError:
prefill: !((prefs!.getString(
"hostHeaders") ??
{}) ==
"{}"));
prefs!.setString("hostHeaders", tmp);
},
icon: const Icon(Icons.add_rounded)),
suffixIcon: useHost
? const SizedBox.shrink()
: (hostLoading
? Transform.scale(
scale: 0.5,
child:
const CircularProgressIndicator())
: IconButton(
tooltip:
AppLocalizations.of(context)! AppLocalizations.of(context)!
.tooltipSave, .settingsHostHeaderInvalid,
onPressed: () { prefill: !((prefs!.getString(
selectionHaptic(); "hostHeaders") ??
checkHost(); {}) ==
}, "{}"));
icon: prefs!.setString("hostHeaders", tmp);
const Icon(Icons.save_rounded), },
)), icon: const Icon(Icons.add_rounded)),
border: const OutlineInputBorder(), suffixIcon: useHost
error: (hostInvalidHost || hostInvalidUrl) ? const SizedBox.shrink()
? InkWell( : (hostLoading
onTap: () { ? Transform.scale(
selectionHaptic(); scale: 0.5,
ScaffoldMessenger.of(context) child:
.showSnackBar(SnackBar( const CircularProgressIndicator())
content: Text(AppLocalizations : IconButton(
.of(context)! tooltip:
.settingsHostInvalidDetailed( AppLocalizations.of(context)!
.tooltipSave,
onPressed: () {
selectionHaptic();
checkHost();
},
icon: const Icon(
Icons.save_rounded),
)),
border: const OutlineInputBorder(),
error: (hostInvalidHost || hostInvalidUrl)
? InkWell(
onTap: () {
selectionHaptic();
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(
content: Text(AppLocalizations
.of(context)!
.settingsHostInvalidDetailed(
hostInvalidHost
? "host"
: "url")),
showCloseIcon: true));
},
splashFactory: NoSplash.splashFactory,
highlightColor: Colors.transparent,
hoverColor: Colors.transparent,
child: Row(
children: [
Icon(Icons.error_rounded,
color: Theme.of(context)
.colorScheme
.error),
const SizedBox(width: 8),
Text(
AppLocalizations.of(context)!
.settingsHostInvalid(
hostInvalidHost hostInvalidHost
? "host" ? "host"
: "url")), : "url"),
showCloseIcon: true));
},
splashFactory: NoSplash.splashFactory,
highlightColor: Colors.transparent,
hoverColor: Colors.transparent,
child: Row(
children: [
Icon(Icons.error_rounded,
color: Theme.of(context)
.colorScheme
.error),
const SizedBox(width: 8),
Text(
AppLocalizations.of(context)!
.settingsHostInvalid(
hostInvalidHost
? "host"
: "url"),
style: TextStyle(
color: Theme.of(context)
.colorScheme
.error))
],
))
: null,
helper: InkWell(
onTap: () {
selectionHaptic();
},
splashFactory: NoSplash.splashFactory,
highlightColor: Colors.transparent,
hoverColor: Colors.transparent,
child: hostLoading
? Row(
children: [
const Icon(Icons.search_rounded,
color: Colors.grey),
const SizedBox(width: 8),
Text(
AppLocalizations.of(context)!
.settingsHostChecking,
style: const TextStyle(
color: Colors.grey,
fontFamily: "monospace"))
],
)
: Row(
children: [
Icon(Icons.check_rounded,
color: Colors.green
.harmonizeWith(
Theme.of(context)
.colorScheme
.primary)),
const SizedBox(width: 8),
Text(
AppLocalizations.of(context)!
.settingsHostValid,
style: TextStyle( style: TextStyle(
color: Colors.green color: Theme.of(context)
.harmonizeWith( .colorScheme
Theme.of(context) .error))
.colorScheme
.primary),
fontFamily: "monospace"))
], ],
)))) ))
]); : null,
var column2 = helper: InkWell(
Column(mainAxisSize: MainAxisSize.min, children: [ onTap: () {
button( selectionHaptic();
AppLocalizations.of(context)!.settingsTitleBehavior, },
Icons.psychology_rounded, () { splashFactory: NoSplash.splashFactory,
selectionHaptic(); highlightColor: Colors.transparent,
Navigator.push( hoverColor: Colors.transparent,
context, child: hostLoading
MaterialPageRoute( ? Row(
builder: (context) => children: [
const ScreenSettingsBehavior())); const Icon(Icons.search_rounded,
}, color: Colors.grey),
context: context, const SizedBox(width: 8),
description: Text(
"\n${AppLocalizations.of(context)!.settingsDescriptionBehavior}"),
button(
AppLocalizations.of(context)!
.settingsTitleInterface,
Icons.web_asset_rounded, () {
selectionHaptic();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const ScreenSettingsInterface()));
},
context: context,
description:
"\n${AppLocalizations.of(context)!.settingsDescriptionInterface}"),
(!desktopFeature(web: true))
? button(
AppLocalizations.of(context)!
.settingsTitleVoice,
Icons.headphones_rounded, () {
selectionHaptic();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const ScreenSettingsVoice()));
},
context: context,
description:
"\n${AppLocalizations.of(context)!.settingsDescriptionVoice}",
badge: AppLocalizations.of(context)!
.settingsExperimentalBeta)
: const SizedBox.shrink(),
button(
AppLocalizations.of(context)!.settingsTitleExport,
Icons.share_rounded, () {
selectionHaptic();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const ScreenSettingsExport()));
},
context: context,
description:
"\n${AppLocalizations.of(context)!.settingsDescriptionExport}"),
button(AppLocalizations.of(context)!.settingsTitleAbout,
Icons.help_rounded, () {
selectionHaptic();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const ScreenSettingsAbout()));
},
context: context,
description:
"\n${AppLocalizations.of(context)!.settingsDescriptionAbout}")
]);
animatedDesktop = desktopLayoutNotRequired(context);
return Column(children: [
Expanded(
child: desktopLayoutNotRequired(context)
? Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
column1,
Expanded(
child: Center(
child: InkWell(
splashFactory:
NoSplash.splashFactory,
highlightColor:
Colors.transparent,
enableFeedback: false,
hoverColor: Colors.transparent,
onTap: () async {
if (iconSize != 1) return;
heavyHaptic();
setState(() {
iconSize = 0.8;
});
await Future.delayed(
const Duration(
milliseconds: 200));
setState(() {
iconSize = 1.2;
});
await Future.delayed(
const Duration(
milliseconds: 200));
setState(() {
iconSize = 1;
});
},
child: AnimatedScale(
scale: iconSize,
duration: const Duration(
milliseconds: 400),
child: const ImageIcon(
AssetImage(
"assets/logo512.png"),
size: 44),
),
))),
Transform.translate(
offset: const Offset(0, 8),
child: button(
AppLocalizations.of( AppLocalizations.of(
context)! context)!
.settingsSavedAutomatically, .settingsHostChecking,
Icons.info_rounded, style: const TextStyle(
null, color: Colors.grey,
color: Colors.grey fontFamily:
"monospace"))
],
)
: Row(
children: [
Icon(Icons.check_rounded,
color: Colors.green
.harmonizeWith( .harmonizeWith(
Theme.of(context) Theme.of(context)
.colorScheme .colorScheme
.primary)), .primary)),
) const SizedBox(width: 8),
])), Text(
verticalTitleDivider(context: context), AppLocalizations.of(
Expanded(child: column2) context)!
]) .settingsHostValid,
: ListView(children: [ style: TextStyle(
column1, color: Colors.green
AnimatedOpacity( .harmonizeWith(
opacity: animatedDesktop ? 0 : 1, Theme.of(
duration: context)
const Duration(milliseconds: 200), .colorScheme
child: titleDivider(bottom: 4)), .primary),
AnimatedOpacity( fontFamily:
opacity: animatedDesktop ? 0 : 1, "monospace"))
duration: ],
const Duration(milliseconds: 200), ))))
child: column2) ]);
])), var column2 =
const SizedBox(height: 8), Column(mainAxisSize: MainAxisSize.min, children: [
desktopLayoutNotRequired(context) button(
? const SizedBox.shrink() AppLocalizations.of(context)!
: button( .settingsTitleBehavior,
AppLocalizations.of(context)! Icons.psychology_rounded, () {
.settingsSavedAutomatically, selectionHaptic();
Icons.info_rounded, Navigator.push(
null, context,
color: Colors.grey.harmonizeWith( MaterialPageRoute(
Theme.of(context).colorScheme.primary)) builder: (context) =>
]); const ScreenSettingsBehavior()));
}))))); },
context: context,
description:
"\n${AppLocalizations.of(context)!.settingsDescriptionBehavior}"),
button(
AppLocalizations.of(context)!
.settingsTitleInterface,
Icons.web_asset_rounded, () {
selectionHaptic();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const ScreenSettingsInterface()));
},
context: context,
description:
"\n${AppLocalizations.of(context)!.settingsDescriptionInterface}"),
(!desktopFeature(web: true))
? button(
AppLocalizations.of(context)!
.settingsTitleVoice,
Icons.headphones_rounded, () {
selectionHaptic();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const ScreenSettingsVoice()));
},
context: context,
description:
"\n${AppLocalizations.of(context)!.settingsDescriptionVoice}",
badge: AppLocalizations.of(context)!
.settingsExperimentalBeta)
: const SizedBox.shrink(),
button(
AppLocalizations.of(context)!.settingsTitleExport,
Icons.share_rounded, () {
selectionHaptic();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const ScreenSettingsExport()));
},
context: context,
description:
"\n${AppLocalizations.of(context)!.settingsDescriptionExport}"),
button(
AppLocalizations.of(context)!.settingsTitleAbout,
Icons.help_rounded, () {
selectionHaptic();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const ScreenSettingsAbout()));
},
context: context,
description:
"\n${AppLocalizations.of(context)!.settingsDescriptionAbout}")
]);
animatedDesktop = desktopLayoutNotRequired(context);
return Column(children: [
Expanded(
child: desktopLayoutNotRequired(context)
? Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
mainAxisSize:
MainAxisSize.max,
children: [
column1,
Expanded(
child: Center(
child: InkWell(
splashFactory:
NoSplash.splashFactory,
highlightColor:
Colors.transparent,
enableFeedback: false,
hoverColor:
Colors.transparent,
onTap: () async {
if (iconSize != 1) return;
heavyHaptic();
setState(() {
iconSize = 0.8;
});
await Future.delayed(
const Duration(
milliseconds: 200));
setState(() {
iconSize = 1.2;
});
await Future.delayed(
const Duration(
milliseconds: 200));
setState(() {
iconSize = 1;
});
},
child: AnimatedScale(
scale: iconSize,
duration: const Duration(
milliseconds: 400),
child: const ImageIcon(
AssetImage(
"assets/logo512.png"),
size: 44),
),
))),
Transform.translate(
offset: const Offset(0, 8),
child: button(
AppLocalizations.of(
context)!
.settingsSavedAutomatically,
Icons.info_rounded,
null,
color: Colors.grey
.harmonizeWith(
Theme.of(context)
.colorScheme
.primary)),
)
])),
verticalTitleDivider(
context: context),
Expanded(child: column2)
])
: ListView(children: [
column1,
AnimatedOpacity(
opacity: animatedDesktop ? 0 : 1,
duration:
const Duration(milliseconds: 200),
child: titleDivider(bottom: 4)),
AnimatedOpacity(
opacity: animatedDesktop ? 0 : 1,
duration:
const Duration(milliseconds: 200),
child: column2)
])),
const SizedBox(height: 8),
desktopLayoutNotRequired(context)
? const SizedBox.shrink()
: button(
AppLocalizations.of(context)!
.settingsSavedAutomatically,
Icons.info_rounded,
null,
color: Colors.grey.harmonizeWith(
Theme.of(context).colorScheme.primary))
]);
})),
))));
} }
} }

View File

@ -345,10 +345,6 @@ class _ScreenSettingsInterfaceState extends State<ScreenSettingsInterface> {
selectionHaptic(); selectionHaptic();
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
barrierColor: (Theme.of(context).brightness ==
Brightness.dark)
? Colors.grey.withOpacity(0.2)
: null,
builder: (context) { builder: (context) {
return StatefulBuilder( return StatefulBuilder(
builder: (context, setState) { builder: (context, setState) {

View File

@ -180,10 +180,6 @@ class _ScreenSettingsVoiceState extends State<ScreenSettingsVoice> {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
barrierColor:
(Theme.of(context).brightness == Brightness.dark)
? Colors.grey.withOpacity(0.2)
: null,
builder: builder:
(context) => StatefulBuilder( (context) => StatefulBuilder(
builder: (context, setLocalState) { builder: (context, setLocalState) {

View File

@ -290,11 +290,7 @@ void setModel(BuildContext context, Function setState) {
}); });
} else { } else {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context, builder: (context) => Container(child: content));
barrierColor: (Theme.of(context).brightness == Brightness.dark)
? Colors.grey.withOpacity(0.2)
: null,
builder: (context) => Container(child: content));
} }
} }
@ -506,9 +502,6 @@ Future<String> prompt(BuildContext context,
String? error; String? error;
await showModalBottomSheet( await showModalBottomSheet(
context: context, context: context,
barrierColor: (Theme.of(context).brightness == Brightness.dark)
? Colors.grey.withOpacity(0.2)
: null,
isScrollControlled: true, isScrollControlled: true,
builder: (context) { builder: (context) {
return StatefulBuilder(builder: (context, setLocalState) { return StatefulBuilder(builder: (context, setLocalState) {