170 lines
6.4 KiB
Dart
170 lines
6.4 KiB
Dart
import 'package:fcs/pages/payment_editor.dart';
|
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:fcs/model/main_model.dart';
|
|
import 'package:fcs/widget/localization/app_translations.dart';
|
|
import 'package:fcs/widget/progress.dart';
|
|
|
|
import '../theme/theme.dart';
|
|
|
|
class PaymentMethodPage extends StatefulWidget {
|
|
@override
|
|
_PaymentMethodPageState createState() => _PaymentMethodPageState();
|
|
}
|
|
|
|
class _PaymentMethodPageState extends State<PaymentMethodPage> {
|
|
bool _isLoading = false;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
MainModel mainModel = Provider.of<MainModel>(context);
|
|
|
|
return LocalProgress(
|
|
inAsyncCall: _isLoading,
|
|
child: Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(
|
|
AppTranslations.of(context).text("payment.method.title"),
|
|
),
|
|
backgroundColor: primaryColor,
|
|
actions: <Widget>[],
|
|
),
|
|
body: ListView.separated(
|
|
separatorBuilder: (context, index) => Divider(
|
|
color: Colors.black,
|
|
),
|
|
itemCount: mainModel.paymentMethods.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
var method = mainModel.paymentMethods[index];
|
|
return InkWell(
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
BottomUpPageRoute(PaymentMethodEditor(
|
|
paymentMethod: method,
|
|
)),
|
|
);
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Text(
|
|
method.name,
|
|
style: TextStyle(
|
|
color: primaryColor,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 18),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
// Text(
|
|
// 'Account Name: ',
|
|
// style: TextStyle(
|
|
// color: Colors.black,
|
|
// fontWeight: FontWeight.normal,
|
|
// fontSize: 15),
|
|
// ),
|
|
Text(
|
|
method.accountName,
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: 15),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
// Text(
|
|
// 'Account Number: ',
|
|
// style: TextStyle(
|
|
// color: Colors.black,
|
|
// fontWeight: FontWeight.normal,
|
|
// fontSize: 15),
|
|
// ),
|
|
Text(
|
|
method.account,
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: 15),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
// Text(
|
|
// 'Email: ',
|
|
// style: TextStyle(
|
|
// color: Colors.black,
|
|
// fontWeight: FontWeight.normal,
|
|
// fontSize: 15),
|
|
// ),
|
|
Text(
|
|
method.mail,
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: 15),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
// Text(
|
|
// 'Phone: ',
|
|
// style: TextStyle(
|
|
// color: Colors.black,
|
|
// fontWeight: FontWeight.normal,
|
|
// fontSize: 15),
|
|
// ),
|
|
Text(
|
|
method.phone,
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: 15),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
floatingActionButton: FloatingActionButton.extended(
|
|
onPressed: () {
|
|
Navigator.push(
|
|
context,
|
|
BottomUpPageRoute(PaymentMethodEditor()),
|
|
);
|
|
},
|
|
icon: Icon(Icons.add),
|
|
label: Text(AppTranslations.of(context).text("discount.new")),
|
|
backgroundColor: primaryColor,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|