refactor ui
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
2025-09-05 09:27:32 -05:00
parent f16f6b808e
commit f5df53f781
10 changed files with 380 additions and 694 deletions

View File

@@ -96,7 +96,7 @@ createUriValidator<Validator>({host, port}) {
Uri.tryParse('http://${host ?? value}:${port ?? value}/') != null; Uri.tryParse('http://${host ?? value}:${port ?? value}/') != null;
} }
createHostNameOrIpValidators() => <Validator>[ List<Validator> createHostNameOrIpValidators() => <Validator>[
trimNotEmptyValidator, trimNotEmptyValidator,
createUriValidator(port: 9000), createUriValidator(port: 9000),
]; ];
@@ -153,7 +153,11 @@ void displayAuthError(Auth auth) {
); );
} }
void displayErrorMessage(context, String text, {bool clear = false}) { void displayErrorMessage(
BuildContext context,
String text, {
bool clear = false,
}) {
if (!context.mounted) { if (!context.mounted) {
return; return;
} }
@@ -431,9 +435,17 @@ Future<String?> editMountLocation(
} }
Scaffold createCommonScaffold( Scaffold createCommonScaffold(
BuildContext context,
String title,
List<Widget> children, { List<Widget> children, {
Widget? advancedWidget,
Widget? floatingActionButton, Widget? floatingActionButton,
}) => Scaffold( bool showBack = false,
}) {
final scheme = Theme.of(context).colorScheme;
final textTheme = Theme.of(context).textTheme;
return Scaffold(
body: SafeArea( body: SafeArea(
child: Stack( child: Stack(
children: [ children: [
@@ -458,12 +470,131 @@ Scaffold createCommonScaffold(
child: Container(color: Colors.black.withValues(alpha: 0.06)), child: Container(color: Colors.black.withValues(alpha: 0.06)),
), ),
), ),
Padding(
padding: const EdgeInsets.all(constants.padding),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
children: [
if (!showBack) ...[
SizedBox(
width: 40,
height: 40,
child: Image.asset(
'assets/images/repertory.png',
fit: BoxFit.contain,
errorBuilder: (_, _, _) {
return Icon(
Icons.folder,
color: scheme.primary,
size: 32,
);
},
),
),
const SizedBox(width: constants.padding),
],
if (showBack) ...[
Material(
color: Colors.transparent,
child: InkWell(
borderRadius: BorderRadius.circular(
constants.borderRadius,
),
onTap: () => Navigator.of(context).pop(),
child: Ink(
width: 40,
height: 40,
decoration: BoxDecoration(
color: scheme.surface.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(
constants.borderRadius,
),
border: Border.all(
color: scheme.outlineVariant.withValues(
alpha: 0.08,
),
width: 1,
),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.22),
blurRadius: constants.borderRadius,
offset: Offset(0, constants.borderRadius),
),
],
),
child: const Icon(Icons.arrow_back),
),
),
),
const SizedBox(width: constants.padding),
],
Expanded(
child: Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: 0.2,
color: scheme.onSurface.withValues(alpha: 0.96),
),
),
),
const SizedBox(width: constants.padding),
if (!showBack) ...[
const Text("Auto-start"),
Consumer<Settings>(
builder: (context, settings, _) {
return IconButton(
icon: Icon(
settings.autoStart
? Icons.toggle_on
: Icons.toggle_off,
),
color: settings.autoStart
? scheme.primary
: scheme.onSurface.withValues(alpha: 0.70),
onPressed: () =>
settings.setAutoStart(!settings.autoStart),
);
},
),
IconButton(
tooltip: 'Settings',
icon: const Icon(Icons.settings),
onPressed: () {
Navigator.pushNamed(context, '/settings');
},
),
const SizedBox(width: constants.padding),
],
if (showBack && advancedWidget != null) ...[
advancedWidget,
const SizedBox(width: constants.padding),
],
Consumer<Auth>(
builder: (context, auth, _) => IconButton(
tooltip: 'Log out',
icon: const Icon(Icons.logout),
onPressed: auth.logoff,
),
),
],
),
const SizedBox(height: constants.padding),
...children, ...children,
], ],
), ),
), ),
],
),
),
floatingActionButton: floatingActionButton, floatingActionButton: floatingActionButton,
); );
}
InputDecoration createCommonDecoration( InputDecoration createCommonDecoration(
ColorScheme colorScheme, ColorScheme colorScheme,

View File

@@ -98,7 +98,7 @@ class MountList with ChangeNotifier {
} }
} }
void _sort(list) { void _sort(List list) {
list.sort((a, b) { list.sort((a, b) {
final res = a.type.compareTo(b.type); final res = a.type.compareTo(b.type);
if (res != 0) { if (res != 0) {

View File

@@ -8,7 +8,7 @@ import 'package:repertory/models/auth.dart';
class Settings with ChangeNotifier { class Settings with ChangeNotifier {
final Auth _auth; final Auth _auth;
bool _autoStart = false; bool _autoStart = false;
bool _enableAnimations = true; bool _enableAnimations = false;
Settings(this._auth) { Settings(this._auth) {
_auth.addListener(() { _auth.addListener(() {

View File

@@ -1,6 +1,5 @@
// add_mount_screen.dart // add_mount_screen.dart
import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -45,92 +44,8 @@ class _AddMountScreenState extends State<AddMountScreen>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme; final scheme = Theme.of(context).colorScheme;
final textTheme = Theme.of(context).textTheme;
return createCommonScaffold([ return createCommonScaffold(context, widget.title, [
Padding(
padding: const EdgeInsets.all(constants.padding),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
children: [
Material(
color: Colors.transparent,
child: InkWell(
borderRadius: BorderRadius.circular(constants.borderRadius),
onTap: () => Navigator.of(context).pop(),
child: Ink(
width: 40,
height: 40,
decoration: BoxDecoration(
color: scheme.surface.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(
constants.borderRadius,
),
border: Border.all(
color: scheme.outlineVariant.withValues(alpha: 0.08),
width: 1,
),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.22),
blurRadius: constants.borderRadius,
offset: Offset(0, constants.borderRadius),
),
],
),
child: const Icon(Icons.arrow_back),
),
),
),
const SizedBox(width: constants.padding),
Expanded(
child: Text(
widget.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: 0.2,
color: scheme.onSurface.withValues(alpha: 0.96),
),
),
),
const SizedBox(width: constants.padding),
ClipRRect(
borderRadius: BorderRadius.circular(constants.borderRadius),
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: constants.borderRadius,
sigmaY: constants.borderRadius,
),
child: Container(
height: 40,
padding: const EdgeInsets.symmetric(horizontal: 6),
decoration: BoxDecoration(
color: scheme.surface.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(
constants.borderRadius,
),
border: Border.all(
color: scheme.outlineVariant.withValues(alpha: 0.08),
width: 1,
),
),
child: Consumer<Auth>(
builder: (context, auth, _) => IconButton(
tooltip: 'Log out',
icon: const Icon(Icons.logout),
onPressed: auth.logoff,
),
),
),
),
),
],
),
const SizedBox(height: constants.padding),
AppDropdownFormField<String>( AppDropdownFormField<String>(
constrainToIntrinsic: true, constrainToIntrinsic: true,
isExpanded: false, isExpanded: false,
@@ -153,9 +68,7 @@ class _AddMountScreenState extends State<AddMountScreen>
autofocus: true, autofocus: true,
controller: _mountNameController, controller: _mountNameController,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
inputFormatters: [ inputFormatters: [FilteringTextInputFormatter.deny(RegExp(r'\s'))],
FilteringTextInputFormatter.deny(RegExp(r'\s')),
],
onChanged: (_) => _handleChange( onChanged: (_) => _handleChange(
Provider.of<Auth>(context, listen: false), Provider.of<Auth>(context, listen: false),
_mountType, _mountType,
@@ -172,9 +85,7 @@ class _AddMountScreenState extends State<AddMountScreen>
const SizedBox(height: constants.padding), const SizedBox(height: constants.padding),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: constants.padding),
horizontal: constants.padding,
),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(constants.borderRadius), borderRadius: BorderRadius.circular(constants.borderRadius),
child: MountSettingsWidget( child: MountSettingsWidget(
@@ -198,13 +109,9 @@ class _AddMountScreenState extends State<AddMountScreen>
foregroundColor: scheme.primary, foregroundColor: scheme.primary,
elevation: 0, elevation: 0,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(constants.borderRadius),
constants.borderRadius,
),
side: BorderSide( side: BorderSide(
color: scheme.outlineVariant.withValues( color: scheme.outlineVariant.withValues(alpha: 0.15),
alpha: 0.15,
),
width: 1, width: 1,
), ),
), ),
@@ -223,9 +130,7 @@ class _AddMountScreenState extends State<AddMountScreen>
elevation: 8, elevation: 8,
shadowColor: scheme.primary.withValues(alpha: 0.45), shadowColor: scheme.primary.withValues(alpha: 0.45),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(constants.borderRadius),
constants.borderRadius,
),
), ),
), ),
onPressed: () async { onPressed: () async {
@@ -245,9 +150,7 @@ class _AddMountScreenState extends State<AddMountScreen>
return; return;
} }
if (mountList.hasConfigName( if (mountList.hasConfigName(_mountNameController.text)) {
_mountNameController.text,
)) {
return displayErrorMessage( return displayErrorMessage(
context, context,
"Configuration name '${_mountNameController.text}' already exists", "Configuration name '${_mountNameController.text}' already exists",
@@ -283,10 +186,7 @@ class _AddMountScreenState extends State<AddMountScreen>
], ],
), ),
], ],
], ], showBack: true);
),
),
]);
} }
void _handleChange(Auth auth, String mountType) { void _handleChange(Auth auth, String mountType) {

View File

@@ -1,12 +1,9 @@
// edit_mount_screen.dart // edit_mount_screen.dart
import 'dart:convert'; import 'dart:convert';
import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:repertory/constants.dart' as constants; import 'package:repertory/constants.dart' as constants;
import 'package:repertory/helpers.dart'; import 'package:repertory/helpers.dart';
import 'package:repertory/models/auth.dart';
import 'package:repertory/models/mount.dart'; import 'package:repertory/models/mount.dart';
import 'package:repertory/utils/safe_set_state_mixin.dart'; import 'package:repertory/utils/safe_set_state_mixin.dart';
import 'package:repertory/widgets/mount_settings.dart'; import 'package:repertory/widgets/mount_settings.dart';
@@ -28,149 +25,13 @@ class _EditMountScreenState extends State<EditMountScreen>
Widget build(BuildContext context) { Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme; final scheme = Theme.of(context).colorScheme;
final textTheme = Theme.of(context).textTheme; final textTheme = Theme.of(context).textTheme;
return createCommonScaffold(
return createCommonScaffold([ context,
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: constants.padding),
Padding(
padding: const EdgeInsets.symmetric(horizontal: constants.padding),
child: Row(
children: [
Material(
color: Colors.transparent,
child: InkWell(
borderRadius: BorderRadius.circular(constants.borderRadius),
onTap: () => Navigator.of(context).pop(),
child: Ink(
width: 40,
height: 40,
decoration: BoxDecoration(
color: scheme.surface.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(
constants.borderRadius,
),
border: Border.all(
color: scheme.outlineVariant.withValues(alpha: 0.08),
width: 1,
),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.22),
blurRadius: constants.borderRadius,
offset: Offset(0, constants.borderRadius),
),
],
),
child: const Icon(Icons.arrow_back),
),
),
),
const SizedBox(width: constants.padding),
Expanded(
child: Text(
widget.title, widget.title,
maxLines: 1, [
overflow: TextOverflow.ellipsis,
style: textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: 0.2,
color: scheme.onSurface.withValues(alpha: 0.96),
),
),
),
const SizedBox(width: constants.padding),
ClipRRect(
borderRadius: BorderRadius.circular(constants.borderRadius),
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: constants.borderRadius,
sigmaY: constants.borderRadius,
),
child: Container(
height: 40,
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: scheme.surface.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(
constants.borderRadius,
),
border: Border.all(
color: scheme.outlineVariant.withValues(alpha: 0.08),
width: 1,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Advanced",
style: textTheme.labelLarge?.copyWith(
color: scheme.onSurface.withValues(alpha: 0.90),
),
),
const SizedBox(width: 6),
IconButton(
tooltip: _showAdvanced
? 'Hide advanced'
: 'Show advanced',
icon: Icon(
_showAdvanced
? Icons.toggle_on
: Icons.toggle_off,
),
color: _showAdvanced
? scheme.primary
: scheme.onSurface.withValues(alpha: 0.70),
onPressed: () =>
setState(() => _showAdvanced = !_showAdvanced),
),
],
),
),
),
),
const SizedBox(width: constants.padding),
ClipRRect(
borderRadius: BorderRadius.circular(constants.borderRadius),
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: constants.borderRadius,
sigmaY: constants.borderRadius,
),
child: Container(
height: 40,
padding: const EdgeInsets.symmetric(horizontal: 6),
decoration: BoxDecoration(
color: scheme.surface.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(
constants.borderRadius,
),
border: Border.all(
color: scheme.outlineVariant.withValues(alpha: 0.08),
width: 1,
),
),
child: Consumer<Auth>(
builder: (context, auth, _) => IconButton(
tooltip: 'Log out',
icon: const Icon(Icons.logout),
onPressed: auth.logoff,
),
),
),
),
),
],
),
),
const SizedBox(height: constants.padding),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: constants.padding),
horizontal: constants.padding,
),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(constants.borderRadius), borderRadius: BorderRadius.circular(constants.borderRadius),
child: MountSettingsWidget( child: MountSettingsWidget(
@@ -185,7 +46,27 @@ class _EditMountScreenState extends State<EditMountScreen>
), ),
const SizedBox(height: constants.padding), const SizedBox(height: constants.padding),
], ],
showBack: true,
advancedWidget: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Advanced",
style: textTheme.labelLarge?.copyWith(
color: scheme.onSurface.withValues(alpha: 0.90),
), ),
]); ),
const SizedBox(width: 6),
IconButton(
tooltip: _showAdvanced ? 'Hide advanced' : 'Show advanced',
icon: Icon(_showAdvanced ? Icons.toggle_on : Icons.toggle_off),
color: _showAdvanced
? scheme.primary
: scheme.onSurface.withValues(alpha: 0.70),
onPressed: () => setState(() => _showAdvanced = !_showAdvanced),
),
],
),
);
} }
} }

View File

@@ -2,7 +2,6 @@
import 'dart:convert' show jsonDecode, jsonEncode; import 'dart:convert' show jsonDecode, jsonEncode;
import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -24,106 +23,10 @@ class _EditSettingsScreenState extends State<EditSettingsScreen>
with SafeSetState<EditSettingsScreen> { with SafeSetState<EditSettingsScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme; return createCommonScaffold(context, widget.title, [
final textTheme = Theme.of(context).textTheme;
return createCommonScaffold([
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: constants.padding),
Padding(
padding: const EdgeInsets.symmetric(horizontal: constants.padding),
child: Row(
children: [
Material(
color: Colors.transparent,
child: InkWell(
borderRadius: BorderRadius.circular(constants.borderRadius),
onTap: () {
Navigator.of(context).pop();
},
child: Ink(
width: 40,
height: 40,
decoration: BoxDecoration(
color: scheme.surface.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(
constants.borderRadius,
),
border: Border.all(
color: scheme.outlineVariant.withValues(alpha: 0.08),
width: 1,
),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.22),
blurRadius: constants.borderRadius,
offset: Offset(0, constants.borderRadius),
),
],
),
child: const Icon(Icons.arrow_back),
),
),
),
const SizedBox(width: constants.padding),
Expanded(
child: Text(
widget.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: 0.2,
color: scheme.onSurface.withValues(alpha: 0.96),
),
),
),
const SizedBox(width: constants.padding),
ClipRRect(
borderRadius: BorderRadius.circular(constants.borderRadius),
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: constants.borderRadius,
sigmaY: constants.borderRadius,
),
child: Container(
height: 40,
padding: const EdgeInsets.symmetric(horizontal: 6),
decoration: BoxDecoration(
color: scheme.surface.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(
constants.borderRadius,
),
border: Border.all(
color: scheme.outlineVariant.withValues(alpha: 0.08),
width: 1,
),
),
child: Consumer<Auth>(
builder: (context, auth, _) {
return IconButton(
tooltip: 'Log out',
icon: const Icon(Icons.logout),
onPressed: () {
auth.logoff();
},
);
},
),
),
),
),
],
),
),
const SizedBox(height: constants.padding),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: constants.padding),
horizontal: constants.padding,
),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(constants.borderRadius), borderRadius: BorderRadius.circular(constants.borderRadius),
child: FutureBuilder<Map<String, dynamic>>( child: FutureBuilder<Map<String, dynamic>>(
@@ -135,9 +38,7 @@ class _EditSettingsScreenState extends State<EditSettingsScreen>
} }
return UISettingsWidget( return UISettingsWidget(
origSettings: jsonDecode( origSettings: jsonDecode(jsonEncode(snapshot.requireData)),
jsonEncode(snapshot.requireData),
),
settings: snapshot.requireData, settings: snapshot.requireData,
showAdvanced: false, showAdvanced: false,
); );
@@ -147,9 +48,7 @@ class _EditSettingsScreenState extends State<EditSettingsScreen>
), ),
), ),
const SizedBox(height: constants.padding), const SizedBox(height: constants.padding),
], ], showBack: true);
),
]);
} }
Future<Map<String, dynamic>> _grabSettings() async { Future<Map<String, dynamic>> _grabSettings() async {

View File

@@ -1,12 +1,8 @@
// home_screen.dart // home_screen.dart
import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:repertory/constants.dart' as constants; import 'package:repertory/constants.dart' as constants;
import 'package:repertory/helpers.dart'; import 'package:repertory/helpers.dart';
import 'package:repertory/models/auth.dart';
import 'package:repertory/models/settings.dart';
import 'package:repertory/widgets/mount_list_widget.dart'; import 'package:repertory/widgets/mount_list_widget.dart';
class HomeScreen extends StatefulWidget { class HomeScreen extends StatefulWidget {
@@ -21,131 +17,18 @@ class _HomeScreeState extends State<HomeScreen> {
@override @override
Widget build(context) { Widget build(context) {
final scheme = Theme.of(context).colorScheme; final scheme = Theme.of(context).colorScheme;
final textTheme = Theme.of(context).textTheme;
return createCommonScaffold( return createCommonScaffold(
[ context,
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: constants.padding),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: constants.padding,
),
child: Row(
children: [
SizedBox(
width: 40,
height: 40,
child: Image.asset(
'assets/images/repertory.png',
fit: BoxFit.contain,
errorBuilder: (_, _, _) {
return Icon(
Icons.folder,
color: scheme.primary,
size: 32,
);
},
),
),
const SizedBox(width: constants.padding),
Expanded(
child: Text(
widget.title, widget.title,
maxLines: 1, [
overflow: TextOverflow.ellipsis,
style: textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: 0.2,
color: scheme.onSurface.withValues(alpha: 0.96),
),
),
),
const SizedBox(width: constants.padding),
ClipRRect(
borderRadius: BorderRadius.circular(constants.borderRadius),
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: constants.borderRadius,
sigmaY: constants.borderRadius,
),
child: Container(
height: 40,
padding: const EdgeInsets.symmetric(horizontal: 6),
decoration: BoxDecoration(
color: scheme.surface.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(
constants.borderRadius,
),
border: Border.all(
color: scheme.outlineVariant.withValues(
alpha: 0.08,
),
width: 1,
),
),
child: Row(
children: [
const Text("Auto-start"),
Consumer<Settings>(
builder: (context, settings, _) {
return IconButton(
icon: Icon(
settings.autoStart
? Icons.toggle_on
: Icons.toggle_off,
),
color: settings.autoStart
? scheme.primary
: scheme.onSurface.withValues(
alpha: 0.70,
),
onPressed: () => settings.setAutoStart(
!settings.autoStart,
),
);
},
),
IconButton(
tooltip: 'Settings',
icon: const Icon(Icons.settings),
onPressed: () {
Navigator.pushNamed(context, '/settings');
},
),
Consumer<Auth>(
builder: (context, auth, _) {
return IconButton(
tooltip: 'Log out',
icon: const Icon(Icons.logout),
onPressed: () {
auth.logoff();
},
);
},
),
],
),
),
),
),
],
),
),
const SizedBox(height: constants.padding),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: constants.padding),
horizontal: constants.padding,
),
child: const MountListWidget(), child: const MountListWidget(),
), ),
), ),
], ],
),
],
floatingActionButton: Padding( floatingActionButton: Padding(
padding: const EdgeInsets.all(constants.padding), padding: const EdgeInsets.all(constants.padding),
child: Hero( child: Hero(

View File

@@ -10,7 +10,7 @@ import 'package:repertory/widgets/app_dropdown.dart';
import 'package:settings_ui/settings_ui.dart'; import 'package:settings_ui/settings_ui.dart';
void createBooleanSetting( void createBooleanSetting(
context, BuildContext context,
List<Widget> list, List<Widget> list,
Map<String, dynamic> settings, Map<String, dynamic> settings,
String key, String key,
@@ -38,7 +38,7 @@ void createBooleanSetting(
} }
void createIntListSetting( void createIntListSetting(
context, BuildContext context,
List<Widget> list, List<Widget> list,
Map<String, dynamic> settings, Map<String, dynamic> settings,
String key, String key,
@@ -76,7 +76,7 @@ void createIntListSetting(
} }
void createIntSetting( void createIntSetting(
context, BuildContext context,
List<Widget> list, List<Widget> list,
Map<String, dynamic> settings, Map<String, dynamic> settings,
String key, String key,
@@ -139,7 +139,7 @@ void createIntSetting(
} }
void createPasswordSetting( void createPasswordSetting(
context, BuildContext context,
List<Widget> list, List<Widget> list,
Map<String, dynamic> settings, Map<String, dynamic> settings,
String key, String key,
@@ -267,7 +267,11 @@ void createPasswordSetting(
} }
} }
Widget createSettingTitle(context, String key, String? description) { Widget createSettingTitle(
BuildContext context,
String key,
String? description,
) {
if (description == null) { if (description == null) {
return Text(key); return Text(key);
} }
@@ -288,7 +292,7 @@ Widget createSettingTitle(context, String key, String? description) {
} }
void createStringListSetting( void createStringListSetting(
context, BuildContext context,
List<Widget> list, List<Widget> list,
Map<String, dynamic> settings, Map<String, dynamic> settings,
String key, String key,
@@ -319,7 +323,7 @@ void createStringListSetting(
} }
void createStringSetting( void createStringSetting(
context, BuildContext context,
List<Widget> list, List<Widget> list,
Map<String, dynamic> settings, Map<String, dynamic> settings,
String key, String key,

View File

@@ -7,8 +7,11 @@ class MountConfig {
String path = ''; String path = '';
Map<String, dynamic> _settings = {}; Map<String, dynamic> _settings = {};
final String _type; final String _type;
MountConfig({required name, required type, Map<String, dynamic>? settings}) MountConfig({
: _name = name, required String name,
required String type,
Map<String, dynamic>? settings,
}) : _name = name,
_type = type { _type = type {
if (settings != null) { if (settings != null) {
_settings = settings; _settings = settings;

View File

@@ -190,16 +190,6 @@ class _MountWidgetState extends State<MountWidget>
); );
} }
String _formatType(String type) {
if (type.toUpperCase() == 'S3') {
return 'S3';
}
if (type.isEmpty) {
return type;
}
return type[0].toUpperCase() + type.substring(1).toLowerCase();
}
String _prettyPath(Mount mount) { String _prettyPath(Mount mount) {
if (mount.path.isEmpty && mount.mounted == null) { if (mount.path.isEmpty && mount.mounted == null) {
return 'loading...'; return 'loading...';
@@ -271,6 +261,7 @@ class _MountWidgetState extends State<MountWidget>
return location; return location;
} }
// ignore: use_build_context_synchronously
return editMountLocation(context, await mount.getAvailableLocations()); return editMountLocation(context, await mount.getAvailableLocations());
} }
@@ -294,14 +285,8 @@ class _FramedBox extends StatelessWidget {
final IconData icon; final IconData icon;
final VoidCallback? onTap; final VoidCallback? onTap;
final Color? iconColor; final Color? iconColor;
final double iconSize;
const _FramedBox({ const _FramedBox({required this.icon, this.onTap, this.iconColor});
required this.icon,
this.onTap,
this.iconColor,
this.iconSize = 32,
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -337,7 +322,7 @@ class _FramedBox extends StatelessWidget {
child: Icon( child: Icon(
icon, icon,
color: iconColor ?? scheme.onSurface.withValues(alpha: 0.92), color: iconColor ?? scheme.onSurface.withValues(alpha: 0.92),
size: iconSize, size: 32.0,
), ),
), ),
), ),