Skip to content

Commit

Permalink
Menu Text Button. Floating Edit/Save button
Browse files Browse the repository at this point in the history
  • Loading branch information
cbhernan committed Oct 10, 2024
1 parent cfed1ef commit cc1ed7c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
12 changes: 12 additions & 0 deletions lib/views/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ class _MyHomePageState extends State<MyHomePage> {
child: Scaffold(
key: scaffoldKey,
appBar: AppBar(
leadingWidth: 75,
leading: TextButton(
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0)
),
),
onPressed: () { scaffoldKey.currentState!.openDrawer(); },
child: const Text('Menu', style: TextStyle(
fontSize: 16,
),)
),
title: const Text('Angeleno Account',
style: TextStyle(fontWeight: FontWeight.bold),
)
Expand Down
46 changes: 25 additions & 21 deletions lib/views/screens/profile_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,31 @@ class _ProfileScreenState extends State<ProfileScreen> {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: ElevatedButton(
onPressed: (editMode &&
((user.phone!.isNotEmpty && !validPhoneNumber) ||
!isFormValid) && isNotTestMode
) ? null : () {
if (editMode) {
updateUser();
}
setState(() {
userProvider.toggleEditing();
});
},
child: Text(
editMode ? 'Save' : 'Edit'
),
)
)
]
),
Expanded(
child: SingleChildScrollView(
child: Padding(
Expand All @@ -109,27 +134,6 @@ class _ProfileScreenState extends State<ProfileScreen> {
autovalidateMode: AutovalidateMode.disabled,
child: Column(
children: [
const SizedBox(height: 10.0),
Row(mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: (editMode &&
((user.phone!.isNotEmpty && !validPhoneNumber) ||
!isFormValid) && isNotTestMode
) ? null : () {
if (editMode) {
updateUser();
}
setState(() {
userProvider.toggleEditing();
});
},
child: Text(
editMode ? 'Save' : 'Edit'
),
)
]
),
const SizedBox(height: 25.0),
TextFormField(
enabled: editMode,
Expand Down

0 comments on commit cc1ed7c

Please sign in to comment.