96 lines
2.7 KiB
Dart
96 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../beans/transaction_records_bean.dart';
|
|
|
|
class TransactionPage extends StatefulWidget {
|
|
List<TransactionRecordsBean> recordList;
|
|
|
|
TransactionPage({required this.recordList});
|
|
|
|
@override
|
|
State<TransactionPage> createState() => _TransactionPageState();
|
|
}
|
|
|
|
class _TransactionPageState extends State<TransactionPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Color(0xFF121213),
|
|
appBar: AppBar(
|
|
backgroundColor: Color(0xFF121213),
|
|
title: Text(
|
|
'我的账户',
|
|
style: TextStyle(fontSize: 16, color: Colors.white),
|
|
),
|
|
centerTitle: true,
|
|
leading: IconButton(
|
|
iconSize: 18,
|
|
icon: Icon(Icons.arrow_back_ios_sharp),
|
|
color: Colors.white,
|
|
onPressed: () {
|
|
// 处理返回操作
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
),
|
|
body: Column(
|
|
children: [
|
|
Expanded(
|
|
child: Container(
|
|
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 20),
|
|
child: ListView.builder(
|
|
itemCount: widget.recordList.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return _item(index,widget.recordList[index]);
|
|
}),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
_item(index,TransactionRecordsBean data) {
|
|
final size = MediaQuery.of(context).size;
|
|
final h70 = size.width / 5.142857142857143;
|
|
return Container(
|
|
width: double.infinity,
|
|
height: h70,
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
index != 0
|
|
? Positioned(
|
|
top: 0,
|
|
child: Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
height: 0.33,
|
|
color: Color(0xFF3A3A3A),
|
|
))
|
|
: Container(),
|
|
Positioned(
|
|
top: 15,
|
|
left: 0,
|
|
child: Text(
|
|
'${data.transactionContent}',
|
|
style: TextStyle(fontSize: 11, color: Colors.white),
|
|
)),
|
|
Positioned(
|
|
bottom: 14,
|
|
left: 0,
|
|
child: Text(
|
|
'${data.transactionTime}',
|
|
style: TextStyle(fontSize: 10, color: Color(0xFF6F6F6F)),
|
|
)),
|
|
Positioned(
|
|
right: 0,
|
|
child: Text(
|
|
'${data.transactionAmount}',
|
|
style: TextStyle(fontSize: 11, color: Colors.white),
|
|
)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|