This commit is contained in:
@@ -96,7 +96,7 @@ createUriValidator<Validator>({host, port}) {
|
||||
Uri.tryParse('http://${host ?? value}:${port ?? value}/') != null;
|
||||
}
|
||||
|
||||
createHostNameOrIpValidators() => <Validator>[
|
||||
List<Validator> createHostNameOrIpValidators() => <Validator>[
|
||||
trimNotEmptyValidator,
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
@@ -431,9 +435,17 @@ Future<String?> editMountLocation(
|
||||
}
|
||||
|
||||
Scaffold createCommonScaffold(
|
||||
BuildContext context,
|
||||
String title,
|
||||
List<Widget> children, {
|
||||
Widget? advancedWidget,
|
||||
Widget? floatingActionButton,
|
||||
}) => Scaffold(
|
||||
bool showBack = false,
|
||||
}) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Stack(
|
||||
children: [
|
||||
@@ -458,12 +470,131 @@ Scaffold createCommonScaffold(
|
||||
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,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: floatingActionButton,
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
InputDecoration createCommonDecoration(
|
||||
ColorScheme colorScheme,
|
||||
|
@@ -98,7 +98,7 @@ class MountList with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
void _sort(list) {
|
||||
void _sort(List list) {
|
||||
list.sort((a, b) {
|
||||
final res = a.type.compareTo(b.type);
|
||||
if (res != 0) {
|
||||
|
@@ -8,7 +8,7 @@ import 'package:repertory/models/auth.dart';
|
||||
class Settings with ChangeNotifier {
|
||||
final Auth _auth;
|
||||
bool _autoStart = false;
|
||||
bool _enableAnimations = true;
|
||||
bool _enableAnimations = false;
|
||||
|
||||
Settings(this._auth) {
|
||||
_auth.addListener(() {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
// add_mount_screen.dart
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -45,92 +44,8 @@ class _AddMountScreenState extends State<AddMountScreen>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
|
||||
return createCommonScaffold([
|
||||
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),
|
||||
return createCommonScaffold(context, widget.title, [
|
||||
AppDropdownFormField<String>(
|
||||
constrainToIntrinsic: true,
|
||||
isExpanded: false,
|
||||
@@ -153,9 +68,7 @@ class _AddMountScreenState extends State<AddMountScreen>
|
||||
autofocus: true,
|
||||
controller: _mountNameController,
|
||||
keyboardType: TextInputType.text,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.deny(RegExp(r'\s')),
|
||||
],
|
||||
inputFormatters: [FilteringTextInputFormatter.deny(RegExp(r'\s'))],
|
||||
onChanged: (_) => _handleChange(
|
||||
Provider.of<Auth>(context, listen: false),
|
||||
_mountType,
|
||||
@@ -172,9 +85,7 @@ class _AddMountScreenState extends State<AddMountScreen>
|
||||
const SizedBox(height: constants.padding),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: constants.padding,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: constants.padding),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(constants.borderRadius),
|
||||
child: MountSettingsWidget(
|
||||
@@ -198,13 +109,9 @@ class _AddMountScreenState extends State<AddMountScreen>
|
||||
foregroundColor: scheme.primary,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
constants.borderRadius,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(constants.borderRadius),
|
||||
side: BorderSide(
|
||||
color: scheme.outlineVariant.withValues(
|
||||
alpha: 0.15,
|
||||
),
|
||||
color: scheme.outlineVariant.withValues(alpha: 0.15),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
@@ -223,9 +130,7 @@ class _AddMountScreenState extends State<AddMountScreen>
|
||||
elevation: 8,
|
||||
shadowColor: scheme.primary.withValues(alpha: 0.45),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
constants.borderRadius,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(constants.borderRadius),
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
@@ -245,9 +150,7 @@ class _AddMountScreenState extends State<AddMountScreen>
|
||||
return;
|
||||
}
|
||||
|
||||
if (mountList.hasConfigName(
|
||||
_mountNameController.text,
|
||||
)) {
|
||||
if (mountList.hasConfigName(_mountNameController.text)) {
|
||||
return displayErrorMessage(
|
||||
context,
|
||||
"Configuration name '${_mountNameController.text}' already exists",
|
||||
@@ -283,10 +186,7 @@ class _AddMountScreenState extends State<AddMountScreen>
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
]);
|
||||
], showBack: true);
|
||||
}
|
||||
|
||||
void _handleChange(Auth auth, String mountType) {
|
||||
|
@@ -1,12 +1,9 @@
|
||||
// edit_mount_screen.dart
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:repertory/constants.dart' as constants;
|
||||
import 'package:repertory/helpers.dart';
|
||||
import 'package:repertory/models/auth.dart';
|
||||
import 'package:repertory/models/mount.dart';
|
||||
import 'package:repertory/utils/safe_set_state_mixin.dart';
|
||||
import 'package:repertory/widgets/mount_settings.dart';
|
||||
@@ -28,149 +25,13 @@ class _EditMountScreenState extends State<EditMountScreen>
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
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(
|
||||
return createCommonScaffold(
|
||||
context,
|
||||
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(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: constants.padding,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: constants.padding),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(constants.borderRadius),
|
||||
child: MountSettingsWidget(
|
||||
@@ -185,7 +46,27 @@ class _EditMountScreenState extends State<EditMountScreen>
|
||||
),
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
import 'dart:convert' show jsonDecode, jsonEncode;
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -24,106 +23,10 @@ class _EditSettingsScreenState extends State<EditSettingsScreen>
|
||||
with SafeSetState<EditSettingsScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
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),
|
||||
return createCommonScaffold(context, widget.title, [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: constants.padding,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: constants.padding),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(constants.borderRadius),
|
||||
child: FutureBuilder<Map<String, dynamic>>(
|
||||
@@ -135,9 +38,7 @@ class _EditSettingsScreenState extends State<EditSettingsScreen>
|
||||
}
|
||||
|
||||
return UISettingsWidget(
|
||||
origSettings: jsonDecode(
|
||||
jsonEncode(snapshot.requireData),
|
||||
),
|
||||
origSettings: jsonDecode(jsonEncode(snapshot.requireData)),
|
||||
settings: snapshot.requireData,
|
||||
showAdvanced: false,
|
||||
);
|
||||
@@ -147,9 +48,7 @@ class _EditSettingsScreenState extends State<EditSettingsScreen>
|
||||
),
|
||||
),
|
||||
const SizedBox(height: constants.padding),
|
||||
],
|
||||
),
|
||||
]);
|
||||
], showBack: true);
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> _grabSettings() async {
|
||||
|
@@ -1,12 +1,8 @@
|
||||
// home_screen.dart
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:repertory/constants.dart' as constants;
|
||||
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';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
@@ -21,131 +17,18 @@ class _HomeScreeState extends State<HomeScreen> {
|
||||
@override
|
||||
Widget build(context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
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: [
|
||||
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(
|
||||
context,
|
||||
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(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: constants.padding,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: constants.padding),
|
||||
child: const MountListWidget(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
floatingActionButton: Padding(
|
||||
padding: const EdgeInsets.all(constants.padding),
|
||||
child: Hero(
|
||||
|
@@ -10,7 +10,7 @@ import 'package:repertory/widgets/app_dropdown.dart';
|
||||
import 'package:settings_ui/settings_ui.dart';
|
||||
|
||||
void createBooleanSetting(
|
||||
context,
|
||||
BuildContext context,
|
||||
List<Widget> list,
|
||||
Map<String, dynamic> settings,
|
||||
String key,
|
||||
@@ -38,7 +38,7 @@ void createBooleanSetting(
|
||||
}
|
||||
|
||||
void createIntListSetting(
|
||||
context,
|
||||
BuildContext context,
|
||||
List<Widget> list,
|
||||
Map<String, dynamic> settings,
|
||||
String key,
|
||||
@@ -76,7 +76,7 @@ void createIntListSetting(
|
||||
}
|
||||
|
||||
void createIntSetting(
|
||||
context,
|
||||
BuildContext context,
|
||||
List<Widget> list,
|
||||
Map<String, dynamic> settings,
|
||||
String key,
|
||||
@@ -139,7 +139,7 @@ void createIntSetting(
|
||||
}
|
||||
|
||||
void createPasswordSetting(
|
||||
context,
|
||||
BuildContext context,
|
||||
List<Widget> list,
|
||||
Map<String, dynamic> settings,
|
||||
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) {
|
||||
return Text(key);
|
||||
}
|
||||
@@ -288,7 +292,7 @@ Widget createSettingTitle(context, String key, String? description) {
|
||||
}
|
||||
|
||||
void createStringListSetting(
|
||||
context,
|
||||
BuildContext context,
|
||||
List<Widget> list,
|
||||
Map<String, dynamic> settings,
|
||||
String key,
|
||||
@@ -319,7 +323,7 @@ void createStringListSetting(
|
||||
}
|
||||
|
||||
void createStringSetting(
|
||||
context,
|
||||
BuildContext context,
|
||||
List<Widget> list,
|
||||
Map<String, dynamic> settings,
|
||||
String key,
|
||||
|
@@ -7,8 +7,11 @@ class MountConfig {
|
||||
String path = '';
|
||||
Map<String, dynamic> _settings = {};
|
||||
final String _type;
|
||||
MountConfig({required name, required type, Map<String, dynamic>? settings})
|
||||
: _name = name,
|
||||
MountConfig({
|
||||
required String name,
|
||||
required String type,
|
||||
Map<String, dynamic>? settings,
|
||||
}) : _name = name,
|
||||
_type = type {
|
||||
if (settings != null) {
|
||||
_settings = settings;
|
||||
|
@@ -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) {
|
||||
if (mount.path.isEmpty && mount.mounted == null) {
|
||||
return 'loading...';
|
||||
@@ -271,6 +261,7 @@ class _MountWidgetState extends State<MountWidget>
|
||||
return location;
|
||||
}
|
||||
|
||||
// ignore: use_build_context_synchronously
|
||||
return editMountLocation(context, await mount.getAvailableLocations());
|
||||
}
|
||||
|
||||
@@ -294,14 +285,8 @@ class _FramedBox extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final VoidCallback? onTap;
|
||||
final Color? iconColor;
|
||||
final double iconSize;
|
||||
|
||||
const _FramedBox({
|
||||
required this.icon,
|
||||
this.onTap,
|
||||
this.iconColor,
|
||||
this.iconSize = 32,
|
||||
});
|
||||
const _FramedBox({required this.icon, this.onTap, this.iconColor});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -337,7 +322,7 @@ class _FramedBox extends StatelessWidget {
|
||||
child: Icon(
|
||||
icon,
|
||||
color: iconColor ?? scheme.onSurface.withValues(alpha: 0.92),
|
||||
size: iconSize,
|
||||
size: 32.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user