This commit is contained in:
2022-11-20 07:28:27 +02:00
parent 9bf1363ab5
commit be8015f69f
+39 -41
View File
@@ -43,7 +43,19 @@ class _MyHomePageState extends State<MyHomePage> {
int _total_tasks = 15;
int _water = 7;
final screens = [];
List<Widget> screens = [
SpannableGrid(
cells: [],
rows: 1,
columns: 1,
),
SpannableGrid(
cells: [],
rows: 1,
columns: 1,
),
Stack()
];
void set_total_tasks() {
_total_tasks = tasks.length;
@@ -107,10 +119,8 @@ class _MyHomePageState extends State<MyHomePage> {
});
}
void create_profile_page() {
setState(() {
screens.add(
Stack(
Stack create_profile_page() {
return Stack(
children: [
Column(
children: [
@@ -164,8 +174,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Padding(
padding: EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 60,
@@ -181,8 +190,7 @@ class _MyHomePageState extends State<MyHomePage> {
color: Colors.grey[300],
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 20,
@@ -220,8 +228,7 @@ class _MyHomePageState extends State<MyHomePage> {
height: 20.0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
Icons.accessibility_new,
@@ -256,8 +263,7 @@ class _MyHomePageState extends State<MyHomePage> {
height: 20.0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
Icons.favorite,
@@ -313,8 +319,8 @@ class _MyHomePageState extends State<MyHomePage> {
children: [
Text(
'Achievements',
style: TextStyle(
color: Colors.grey[400], fontSize: 14.0),
style:
TextStyle(color: Colors.grey[400], fontSize: 14.0),
),
SizedBox(
height: 5.0,
@@ -331,8 +337,8 @@ class _MyHomePageState extends State<MyHomePage> {
child: Column(children: [
Text(
'Birthday',
style: TextStyle(
color: Colors.grey[400], fontSize: 14.0),
style:
TextStyle(color: Colors.grey[400], fontSize: 14.0),
),
SizedBox(
height: 5.0,
@@ -350,8 +356,8 @@ class _MyHomePageState extends State<MyHomePage> {
children: [
Text(
'Age',
style: TextStyle(
color: Colors.grey[400], fontSize: 14.0),
style:
TextStyle(color: Colors.grey[400], fontSize: 14.0),
),
SizedBox(
height: 5.0,
@@ -368,15 +374,11 @@ class _MyHomePageState extends State<MyHomePage> {
),
)))
],
),
);
});
}
void create_targets_page() {
setState(() {
screens.add(
SpannableGrid(
SpannableGrid create_targets_page() {
return SpannableGrid(
gridSize: SpannableGridSize.parent,
cells: [
SpannableGridCellData(
@@ -405,8 +407,7 @@ class _MyHomePageState extends State<MyHomePage> {
row: 2,
child: Container(
margin: EdgeInsets.fromLTRB(10, 0, 20, 10),
decoration:
BoxDecoration(borderRadius: BorderRadius.circular(16)),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(16)),
child: LinearPercentIndicator(
alignment: MainAxisAlignment.center,
width: MediaQuery.of(context).size.width * 0.8,
@@ -443,14 +444,11 @@ class _MyHomePageState extends State<MyHomePage> {
],
rows: 10,
columns: 1,
),
);
});
}
void create_home_page() {
setState(() {
screens.add(SpannableGrid(
SpannableGrid create_home_page() {
return SpannableGrid(
cells: [
SpannableGridCellData(
id: 1,
@@ -529,8 +527,7 @@ class _MyHomePageState extends State<MyHomePage> {
SizedBox(
child: LinearPercentIndicator(
alignment: MainAxisAlignment.center,
width:
MediaQuery.of(context).size.width * 0.8,
width: MediaQuery.of(context).size.width * 0.8,
animation: true,
lineHeight: 20.0,
animationDuration: 2500,
@@ -622,9 +619,11 @@ class _MyHomePageState extends State<MyHomePage> {
Colors.deepPurple),
),
onPressed: () {
setState(() {
setState(
() {
_water = _water + 1;
});
},
);
},
child: Text(
'TextButton',
@@ -654,8 +653,7 @@ class _MyHomePageState extends State<MyHomePage> {
style: SpannableGridStyle(
spacing: 10,
),
));
});
);
}
void _onItemTapped(int index) {
@@ -666,9 +664,9 @@ class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
create_targets_page();
create_home_page();
create_profile_page();
screens[0] = create_targets_page();
screens[1] = create_home_page();
screens[2] = create_profile_page();
return Container(
child: Scaffold(
backgroundColor: Colors.transparent,