import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:pweb/controllers/auth/account_name.dart'; class AccountNameActions extends StatelessWidget { const AccountNameActions({super.key}); @override Widget build(BuildContext context) { final state = context.watch(); final theme = Theme.of(context); 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, ), ], ); } }