Created
April 20, 2023 00:42
-
-
Save VB10/9ba7ea032e2c58a5826ca3c93c86d7e5 to your computer and use it in GitHub Desktop.
Use case login view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _LoginViewState extends State<LoginView> with LoginController { | |
late final ClearTextAction textAction; | |
late final ControllerCleaner _controllerCleaner; | |
String _value = ''; | |
@override | |
void initState() { | |
super.initState(); | |
textAction = ClearTextAction(); | |
_controllerCleaner = ControllerCleaner(textAction); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
floatingActionButton: Row( | |
mainAxisSize: MainAxisSize.min, | |
children: [ | |
_homeButton(), | |
_removeButton(), | |
], | |
), | |
appBar: AppBar(), | |
body: _CustomTextField( | |
action: textAction, | |
onChange: (String value) { | |
_value = value; | |
}, | |
)); | |
} | |
FloatingActionButton _homeButton() { | |
return FloatingActionButton.large( | |
child: const Icon(Icons.home), | |
onPressed: () { | |
_controllerCleaner.update('home'); | |
}, | |
); | |
} | |
FloatingActionButton _removeButton() { | |
return FloatingActionButton( | |
child: const Icon(Icons.remove), | |
onPressed: () { | |
_controllerCleaner.clear(); | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment