usability fixes

This commit is contained in:
2026-06-01 20:49:53 +02:00
parent 7b5b962fe6
commit 1d8ab2088c
6 changed files with 167 additions and 38 deletions

View File

@@ -25,6 +25,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
late final router = GoRouter.of(context);
bool _isLoggedIn = false;
bool _isZWGSelected = false;
String initials = '';
late AnimationController _providersAnimController;
@@ -103,7 +104,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
homeController = HomeController(context);
await homeController.getAccounts();
await homeController.getCategories();
await homeController.getProviders();
await homeController.getProviders(_isZWGSelected ? "ZWG" : "USD");
prefs = await SharedPreferences.getInstance();
@@ -124,7 +125,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
Future<void> _onRefresh() async {
await homeController.getAccounts();
await homeController.getCategories();
await homeController.getProviders();
await homeController.getProviders(_isZWGSelected ? "ZWG" : "USD");
prefs = await SharedPreferences.getInstance();
if (prefs.getString("userId") != null) {
@@ -343,14 +344,127 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildSectionLabel(theme, isDark, Icons.grid_view_rounded, "Pay"),
IconButton(
icon: Icon(
Icons.refresh_rounded,
color: isDark ? Colors.white54 : Colors.black54,
size: 20,
),
onPressed: _onRefresh,
tooltip: 'Refresh',
Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 2,
),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF1E1E1E) : Colors.white,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.12)
: Colors.black.withValues(alpha: 0.08),
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'USD',
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: !_isZWGSelected
? theme.colorScheme.primary
: isDark
? Colors.white54
: Colors.black45,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: GestureDetector(
onTap: () {
setState(() {
_isZWGSelected = !_isZWGSelected;
});
if (_isZWGSelected) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Center(
child: const Text(
'ZWG currency not supported yet',
),
),
behavior: SnackBarBehavior.floating,
backgroundColor: theme.colorScheme.primary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
duration: const Duration(seconds: 3),
width: 300,
),
);
}
Future.delayed(
const Duration(milliseconds: 1000),
() {
setState(() {
_isZWGSelected = !_isZWGSelected;
});
},
);
},
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
width: 32,
height: 18,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: _isZWGSelected
? theme.colorScheme.primary
: Colors.grey.shade300,
),
child: AnimatedAlign(
duration: const Duration(milliseconds: 200),
alignment: _isZWGSelected
? Alignment.centerRight
: Alignment.centerLeft,
child: Container(
width: 14,
height: 14,
margin: const EdgeInsets.all(2),
decoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
),
),
),
),
),
Text(
'ZWG',
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: _isZWGSelected
? theme.colorScheme.primary
: isDark
? Colors.white54
: Colors.black45,
),
),
],
),
),
const SizedBox(width: 4),
IconButton(
icon: Icon(
Icons.refresh_rounded,
color: isDark ? Colors.white54 : Colors.black54,
size: 20,
),
onPressed: _onRefresh,
tooltip: 'Refresh',
),
],
),
],
),