diff --git a/lib/pages/more_page.dart b/lib/pages/more_page.dart index 21814de..d05a0a3 100644 --- a/lib/pages/more_page.dart +++ b/lib/pages/more_page.dart @@ -86,11 +86,6 @@ class MorePageState extends State { ), ), ), -// -// Padding( -// padding: EdgeInsets.fromLTRB(10, 15, 0, 0), -// child: Text("helloooo"), -// ), Padding( padding: EdgeInsets.fromLTRB(0.0, 25.0, 0.0, 0.0), diff --git a/lib/pages/receipt_page_2.dart b/lib/pages/receipt_page_2.dart index 979213e..61ba0da 100644 --- a/lib/pages/receipt_page_2.dart +++ b/lib/pages/receipt_page_2.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:local_spend/common/platform/platform_scaffold.dart'; +import 'package:intl/intl.dart'; +import 'package:flutter/cupertino.dart'; class ReceiptPage2 extends StatefulWidget { @override @@ -9,8 +11,11 @@ class ReceiptPage2 extends StatefulWidget { } class ReceiptPage2State extends State { + DateTime _transactionDate = DateTime.now(); + @override Widget build(BuildContext context) { + return PlatformScaffold( appBar: AppBar( backgroundColor: Colors.blue[400], @@ -24,6 +29,82 @@ class ReceiptPage2State extends State { centerTitle: true, iconTheme: IconThemeData(color: Colors.black), ), + + body: ListView( + children: [ + // each CHILD has its own horizontal padding because if the listView has padding, Android's end-of-scroll animation + // doesn't fit the screen properly and looks weird + Container( + padding: const EdgeInsets.fromLTRB(15, 17, 0, 0), + child : Text( + "Receipt Details", + style: TextStyle( + fontSize: 24, + color: Colors.grey[700], + fontWeight: FontWeight.bold, + ), + ), + ), + + Container( + padding: EdgeInsets.fromLTRB(25,15,15.0,0.0), + child: Row( + children: [ + Text( + "Date/Time", + style: TextStyle( + fontSize: 18, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + + Container( + padding: const EdgeInsets.fromLTRB(15, 0, 0, 0), + height: 32.0, + child: RaisedButton( + onPressed: () { + showModalBottomSheet( + context: context, + builder: (BuildContext builder) { + return Container( + height: MediaQuery.of(context).copyWith().size.height / 3, + child: CupertinoDatePicker( + initialDateTime: _transactionDate.isAfter(DateTime.now()) + ? DateTime.now() + : _transactionDate, + onDateTimeChanged: (DateTime newDate) { + setState(() => { + newDate.isAfter(DateTime.now()) + ? _transactionDate = DateTime.now() + : _transactionDate = newDate, + }); + }, + use24hFormat: true, + maximumDate: DateTime.now(), + ), + ); + }); + },// onPressed: () => showDatePicker(context: context, initialDate: _transactionDate, firstDate: null, lastDate: _transactionDate), + child: Text( + _transactionDate == null + ? 'None set.' + : _transactionDate.year == DateTime.now().year + ? '${new DateFormat.MMMd().format(_transactionDate)}' + ", " + '${new DateFormat.Hm().format(_transactionDate)}' + : '${new DateFormat.MMMd().format(_transactionDate)}' + " " + _transactionDate.year.toString() + ", " + '${new DateFormat.Hm().format(_transactionDate)}', + style: + TextStyle(color: Colors.white, fontSize: 18.0), + ), + color: Colors.blue, + ), + ), + ], + ), + ), + + ], + ), + ); } } \ No newline at end of file