133 lines
4.8 KiB
Dart
133 lines
4.8 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(
|
|
leading: new IconButton(
|
|
icon: new Icon(Icons.close),
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
),
|
|
centerTitle: true,
|
|
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(
|
|
method.accountName,
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: 15),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
method.account != null
|
|
? Padding(
|
|
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
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(
|
|
method.link,
|
|
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("payment.method.new")),
|
|
backgroundColor: primaryColor,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|