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
body: Center( | |
child: ElevatedButton( | |
onPressed: () async { | |
await homePageData.saveJsonData(rawData); | |
homePageData.getJsonData(); | |
}, | |
child: const Text('Save Data'), | |
), | |
), |
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
final rawData = <String, dynamic>{'name': 'Alice', 'age': 20}; | |
final defaultData = <String, dynamic>{ | |
'name': 'name not found.', | |
'age': 00, | |
}; |
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 HomePageModel { | |
final String name; | |
final int? age; | |
HomePageModel( | |
this.name, | |
this.age, | |
); | |
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
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), | |
), | |
body: Center( | |
child: ElevatedButton( | |
onPressed: () {}, | |
child: const Text('Save Data'), |
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
Future<void> _changeOpacity() async { | |
setState(() => _visible = !_visible); | |
await Future.delayed(const Duration(milliseconds: 650)); | |
setState(() => showPayBtn = !showPayBtn); | |
setState(() => _visible = !_visible); | |
} |
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
AnimatedOpacity( | |
opacity: _visible ? 1.0 : 0.0, | |
duration: const Duration(milliseconds: 650), | |
child: ElevatedButton( | |
... | |
), | |
), |
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
ElevatedButton( | |
style: ElevatedButton.styleFrom( | |
elevation: 0, | |
primary: primaryColor, | |
minimumSize: const Size(double.infinity, 50), | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(10.0), | |
), | |
), | |
child: Text( |
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
void main() { | |
Student() | |
..name = 'Alice' | |
..id = 'A01' | |
..method1() | |
..method2(); | |
} |
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
void main() { | |
Student student = Student(); | |
student.name='Alice'; | |
student.id='A01'; | |
student.method1(); | |
student.method2(); | |
} |