Add a daily estimate. Move estimates to the right of the list item.
This commit is contained in:
@ -35,12 +35,20 @@ class _ExpensePageState extends State<ExpensePage> {
|
||||
itemCount: expenses.length,
|
||||
itemBuilder: (_, index) {
|
||||
final Expense curr = expenses[index];
|
||||
final String estimateSymbol = switch (curr.frequency.timesPerYear
|
||||
.toStringAsFixed(2)
|
||||
.endsWith(".00")) {
|
||||
true => "",
|
||||
false => "~",
|
||||
};
|
||||
final String estimateSymbolYearly = curr.frequency.timesPerYear
|
||||
.toStringAsFixed(2)
|
||||
.endsWith(".00") &&
|
||||
curr.calcComparableCost().toStringAsFixed(3).endsWith("0")
|
||||
? ""
|
||||
: "~";
|
||||
final String estimateSymbolDaily =
|
||||
curr.frequency.numDays.toStringAsFixed(2).endsWith(".00") &&
|
||||
curr
|
||||
.calcComparableCostDaily()
|
||||
.toStringAsFixed(3)
|
||||
.endsWith("0")
|
||||
? ""
|
||||
: "~";
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Dismissible(
|
||||
@ -113,11 +121,6 @@ class _ExpensePageState extends State<ExpensePage> {
|
||||
"${curr.cost.toStringAsFixed(2)} ${curr.frequency.title}",
|
||||
style: TextStyle(fontSize: 12.0),
|
||||
),
|
||||
if (curr.frequency != Frequency.yearly)
|
||||
Text(
|
||||
"$estimateSymbol${curr.calcComparableCost().toStringAsFixed(2)} Yearly",
|
||||
style: TextStyle(fontSize: 12.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
@ -132,6 +135,21 @@ class _ExpensePageState extends State<ExpensePage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
//if (curr.frequency != Frequency.daily)
|
||||
Text(
|
||||
"$estimateSymbolDaily${curr.calcComparableCostDaily().toStringAsFixed(2)} ${Frequency.daily.title}",
|
||||
style: TextStyle(fontSize: 12.0),
|
||||
),
|
||||
//if (curr.frequency != Frequency.yearly)
|
||||
Text(
|
||||
"$estimateSymbolYearly${curr.calcComparableCost().toStringAsFixed(2)} ${Frequency.yearly.title}",
|
||||
style: TextStyle(fontSize: 12.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -207,6 +225,7 @@ class _ExpenseInputDialogState extends State<ExpenseInputDialog> {
|
||||
children: [
|
||||
TextFormField(
|
||||
keyboardType: TextInputType.text,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
decoration: InputDecoration(
|
||||
labelText: "Name",
|
||||
hintText: "Example: Red Pocket",
|
||||
@ -297,10 +316,11 @@ class _ExpenseInputDialogState extends State<ExpenseInputDialog> {
|
||||
),
|
||||
TextFormField(
|
||||
keyboardType: TextInputType.text,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
decoration: InputDecoration(
|
||||
labelText: "Description",
|
||||
hintText: "Example: 1GB data, unlimited talk & text.",
|
||||
hintStyle: TextStyle(fontSize: 10.0),
|
||||
hintText: "Example: 1GB data with unlimited talk & text.",
|
||||
hintStyle: TextStyle(fontSize: 8.0),
|
||||
errorStyle: TextStyle(fontSize: 10.0),
|
||||
),
|
||||
initialValue: _desc,
|
||||
|
Reference in New Issue
Block a user