Fix the layout when there are no items.
This commit is contained in:
parent
ecbac615e9
commit
360a36f024
@ -118,11 +118,9 @@ class _HomePageState extends State<HomePage> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Container(
|
||||||
child: Container(
|
color: Theme.of(context).colorScheme.primaryContainer,
|
||||||
color: Theme.of(context).colorScheme.primaryContainer,
|
child: Center(child: page),
|
||||||
child: page,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
floatingActionButton: floatingButton,
|
floatingActionButton: floatingButton,
|
||||||
);
|
);
|
||||||
|
@ -12,29 +12,31 @@ class ExpensePage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListView.builder(
|
return expenses.isEmpty
|
||||||
itemCount: expenses.length,
|
? Text("Add expenses to get started!")
|
||||||
itemBuilder: (_, index) {
|
: ListView.builder(
|
||||||
final Expense curr = expenses[index];
|
itemCount: expenses.length,
|
||||||
return Center(
|
itemBuilder: (_, index) {
|
||||||
child: Padding(
|
final Expense curr = expenses[index];
|
||||||
padding: const EdgeInsets.all(4.0),
|
return Center(
|
||||||
child: Container(
|
child: Padding(
|
||||||
decoration: BoxDecoration(
|
padding: const EdgeInsets.all(4.0),
|
||||||
borderRadius: BorderRadius.circular(4),
|
child: Container(
|
||||||
color: Colors.greenAccent,
|
decoration: BoxDecoration(
|
||||||
),
|
borderRadius: BorderRadius.circular(4),
|
||||||
child: Column(
|
color: Colors.greenAccent,
|
||||||
children: [
|
),
|
||||||
Text(curr.name),
|
child: Column(
|
||||||
Text("${curr.cost.toString()} ${curr.frequency.title}"),
|
children: [
|
||||||
],
|
Text(curr.name),
|
||||||
),
|
Text("${curr.cost.toString()} ${curr.frequency.title}"),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user