Layout fixed

This commit is contained in:
Felix 2019-08-05 12:24:40 +01:00
parent e742badcc8
commit 59f69b102f
3 changed files with 47 additions and 31 deletions

View file

@ -6,13 +6,13 @@ PODS:
- Flutter - Flutter
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `.symlinks/flutter/ios-profile`) - Flutter (from `.symlinks/flutter/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`)
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: ".symlinks/flutter/ios-profile" :path: ".symlinks/flutter/ios"
shared_preferences: shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios" :path: ".symlinks/plugins/shared_preferences/ios"
url_launcher: url_launcher:

View file

@ -281,7 +281,7 @@
); );
inputPaths = ( inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios-profile/Flutter.framework", "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
); );
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
outputPaths = ( outputPaths = (

View file

@ -3,6 +3,16 @@ import 'package:local_spend/common/platform/platform_scaffold.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
class Transaction {
DateTime date;
double amount;
Transaction(
this.date,
this.amount,
);
}
class ReceiptPage2 extends StatefulWidget { class ReceiptPage2 extends StatefulWidget {
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -11,9 +21,8 @@ class ReceiptPage2 extends StatefulWidget {
} }
class ReceiptPage2State extends State<ReceiptPage2> { class ReceiptPage2State extends State<ReceiptPage2> {
DateTime _transactionDate = DateTime.now(); Transaction transaction = new Transaction(DateTime.now(), 0);
double _transactionAmount = 0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -52,17 +61,20 @@ class ReceiptPage2State extends State<ReceiptPage2> {
padding: EdgeInsets.fromLTRB(25,15,15.0,0.0), padding: EdgeInsets.fromLTRB(25,15,15.0,0.0),
child: Row( child: Row(
children: <Widget> [ children: <Widget> [
Text( Container(
"Date/Time", child : Text(
style: TextStyle( "Date/Time",
fontSize: 18, style: TextStyle(
color: Colors.black, fontSize: 18,
fontWeight: FontWeight.bold, color: Colors.black,
fontWeight: FontWeight.bold,
),
), ),
width: 110,
), ),
Container( Container(
padding: const EdgeInsets.fromLTRB(15, 0, 0, 0), padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
height: 32.0, height: 32.0,
child: RaisedButton( child: RaisedButton(
onPressed: () { onPressed: () {
@ -72,14 +84,14 @@ class ReceiptPage2State extends State<ReceiptPage2> {
return Container( return Container(
height: MediaQuery.of(context).copyWith().size.height / 3, height: MediaQuery.of(context).copyWith().size.height / 3,
child: CupertinoDatePicker( child: CupertinoDatePicker(
initialDateTime: _transactionDate.isAfter(DateTime.now()) initialDateTime: transaction.date.isAfter(DateTime.now())
? DateTime.now() ? DateTime.now()
: _transactionDate, : transaction.date,
onDateTimeChanged: (DateTime newDate) { onDateTimeChanged: (DateTime newDate) {
setState(() => { setState(() => {
newDate.isAfter(DateTime.now()) newDate.isAfter(DateTime.now())
? _transactionDate = DateTime.now() ? transaction.date = DateTime.now()
: _transactionDate = newDate, : transaction.date = newDate,
}); });
}, },
use24hFormat: true, use24hFormat: true,
@ -89,11 +101,11 @@ class ReceiptPage2State extends State<ReceiptPage2> {
}); });
},// onPressed: () => showDatePicker(context: context, initialDate: _transactionDate, firstDate: null, lastDate: _transactionDate), },// onPressed: () => showDatePicker(context: context, initialDate: _transactionDate, firstDate: null, lastDate: _transactionDate),
child: Text( child: Text(
_transactionDate == null transaction.date == null
? 'None set.' ? 'None set.'
: _transactionDate.year == DateTime.now().year : transaction.date.year == DateTime.now().year
? '${new DateFormat.MMMd().format(_transactionDate)}' + ", " + '${new DateFormat.Hm().format(_transactionDate)}' ? '${new DateFormat.MMMd().format(transaction.date)}' + ", " + '${new DateFormat.Hm().format(transaction.date)}'
: '${new DateFormat.MMMd().format(_transactionDate)}' + " " + _transactionDate.year.toString() + ", " + '${new DateFormat.Hm().format(_transactionDate)}', : '${new DateFormat.MMMd().format(transaction.date)}' + " " + transaction.date.year.toString() + ", " + '${new DateFormat.Hm().format(transaction.date)}',
style: style:
TextStyle(color: Colors.white, fontSize: 18.0), TextStyle(color: Colors.white, fontSize: 18.0),
), ),
@ -108,17 +120,21 @@ class ReceiptPage2State extends State<ReceiptPage2> {
padding: EdgeInsets.fromLTRB(25,15,15.0,0.0), padding: EdgeInsets.fromLTRB(25,15,15.0,0.0),
child: Row( child: Row(
children: <Widget> [ children: <Widget> [
Text( Container(
"Amount", child : Text(
style: TextStyle( "Amount",
fontSize: 18, style: TextStyle(
color: Colors.black, fontSize: 18,
fontWeight: FontWeight.bold, color: Colors.black,
fontWeight: FontWeight.bold,
),
), ),
width: 110,
), ),
Container( Container(
padding: const EdgeInsets.fromLTRB(36, 0, 0, 0), padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
height: 32.0, height: 32.0,
child: RaisedButton( child: RaisedButton(
onPressed: () { onPressed: () {
@ -131,9 +147,9 @@ class ReceiptPage2State extends State<ReceiptPage2> {
}); });
},// onPressed: () => showDatePicker(context: context, initialDate: _transactionDate, firstDate: null, lastDate: _transactionDate), },// onPressed: () => showDatePicker(context: context, initialDate: _transactionDate, firstDate: null, lastDate: _transactionDate),
child: Text( child: Text(
_transactionAmount == null transaction.amount == null
? 'None set.' ? 'None set.'
: "£" + _transactionAmount.toString() + "0", : "£" + transaction.amount.toString() + "0",
style : TextStyle(color: Colors.white, fontSize: 18.0), style : TextStyle(color: Colors.white, fontSize: 18.0),
), ),
color: Colors.blue, color: Colors.blue,
@ -141,7 +157,7 @@ class ReceiptPage2State extends State<ReceiptPage2> {
), ),
], ],
), ),
), // Date/Time picker ), // Amount picker
], ],
), ),