Started prototyping the year value calculation instruction page on the MonthValuesPage
This commit is contained in:
parent
ff95e415d2
commit
d3f55cb9ae
1 changed files with 115 additions and 26 deletions
|
@ -1,32 +1,10 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:ohthatsa/other/AppDrawer.dart';
|
import 'package:ohthatsa/other/AppDrawer.dart';
|
||||||
import 'package:ohthatsa/util/Months.dart';
|
import 'package:ohthatsa/util/Months.dart';
|
||||||
|
|
||||||
class MonthValuesPage extends StatelessWidget {
|
class MonthValuesPage extends StatelessWidget {
|
||||||
final monthTableRowTextStyle = TextStyle(fontSize: 35);
|
|
||||||
|
|
||||||
TableRow getMonthTableRow(MapEntry<String, Month> month) {
|
|
||||||
return TableRow(
|
|
||||||
children: [
|
|
||||||
TableCell(
|
|
||||||
child: Text(
|
|
||||||
month.key,
|
|
||||||
style: monthTableRowTextStyle,
|
|
||||||
textAlign: TextAlign.right
|
|
||||||
)
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
child: Text(
|
|
||||||
month.value.value.toString(),
|
|
||||||
style: monthTableRowTextStyle,
|
|
||||||
textAlign: TextAlign.center
|
|
||||||
)
|
|
||||||
)
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -35,9 +13,120 @@ class MonthValuesPage extends StatelessWidget {
|
||||||
title: Text("Month Values")
|
title: Text("Month Values")
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Table(
|
child: Column(
|
||||||
children: Months.stringMap.entries.map(getMonthTableRow).toList()
|
children: <Widget>[
|
||||||
)
|
Text(
|
||||||
|
"To calculate the value for a year,",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Take only the last two digits: ",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
"YY",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
fontSize: 25
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"YY",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.green,
|
||||||
|
fontSize: 25
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Calculate:",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"(YY + floor(YY / 4)) % 7",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"So for example:",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
"19",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
fontSize: 25
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"67",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.green,
|
||||||
|
fontSize: 25
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"The calculation becomes",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"(67 + floor(67 / 4)) % 7",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Let's first calculate '67 / 4': 16.75",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Fill that into the calculation:",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"(67 + floor(16.75)) % 7",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"'Floor' it:",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"(67 + 16) % 7",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"(67 + 16) % 7",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Calculate '67 + 16': 83",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"And that leaves us with: ",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"83 % 7",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"The final calculation gives us a year value of:",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"6",
|
||||||
|
style: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue