Fixes for Settings Page

This commit is contained in:
Arseni
2025-12-22 21:09:58 +03:00
parent 41abf723e6
commit 47ada0691c
25 changed files with 1126 additions and 270 deletions

View File

@@ -0,0 +1,47 @@
import 'package:flutter/material.dart';
import 'package:pweb/pages/settings/profile/account/name/state.dart';
class AccountNameActions extends StatelessWidget {
const AccountNameActions({
super.key,
required this.state,
});
final AccountNameState state;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
if (state.isEditing) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
icon: Icon(Icons.check, color: theme.colorScheme.primary),
onPressed: state.isBusy
? null
: () async {
final wasSaved = await state.save();
if (!context.mounted || wasSaved || state.errorText.isEmpty) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(state.errorText)),
);
},
),
IconButton(
icon: Icon(Icons.close, color: theme.colorScheme.error),
onPressed: state.isBusy ? null : state.cancelEditing,
),
],
);
}
return IconButton(
icon: Icon(Icons.edit, color: theme.colorScheme.primary),
onPressed: state.isBusy ? null : state.startEditing,
);
}
}