improving ui elements

This commit is contained in:
2025-07-24 23:53:06 +02:00
parent 44d21b3f14
commit daf4450f7a
13 changed files with 904 additions and 630 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,119 @@
class PageableModel {
final List<dynamic> content;
final Pageable pageable;
final int totalPages;
final int totalElements;
final bool last;
final int size;
final int number;
final Sort sort;
final int numberOfElements;
final bool first;
final bool empty;
PageableModel({
required this.content,
required this.pageable,
required this.totalPages,
required this.totalElements,
required this.last,
required this.size,
required this.number,
required this.sort,
required this.numberOfElements,
required this.first,
required this.empty,
});
factory PageableModel.fromJson(Map<String, dynamic> json) {
return PageableModel(
content: json['content'] ?? [],
pageable: Pageable.fromJson(json['pageable']),
totalPages: json['totalPages'],
totalElements: json['totalElements'],
last: json['last'],
size: json['size'],
number: json['number'],
sort: Sort.fromJson(json['sort']),
numberOfElements: json['numberOfElements'],
first: json['first'],
empty: json['empty'],
);
}
Map<String, dynamic> toJson() {
return {
'content': content,
'pageable': pageable.toJson(),
'totalPages': totalPages,
'totalElements': totalElements,
'last': last,
'size': size,
'number': number,
'sort': sort.toJson(),
'numberOfElements': numberOfElements,
'first': first,
'empty': empty,
};
}
}
class Pageable {
final int pageNumber;
final int pageSize;
final Sort sort;
final int offset;
final bool paged;
final bool unpaged;
Pageable({
required this.pageNumber,
required this.pageSize,
required this.sort,
required this.offset,
required this.paged,
required this.unpaged,
});
factory Pageable.fromJson(Map<String, dynamic> json) {
return Pageable(
pageNumber: json['pageNumber'],
pageSize: json['pageSize'],
sort: Sort.fromJson(json['sort']),
offset: json['offset'],
paged: json['paged'],
unpaged: json['unpaged'],
);
}
Map<String, dynamic> toJson() {
return {
'pageNumber': pageNumber,
'pageSize': pageSize,
'sort': sort.toJson(),
'offset': offset,
'paged': paged,
'unpaged': unpaged,
};
}
}
class Sort {
final bool sorted;
final bool empty;
final bool unsorted;
Sort({required this.sorted, required this.empty, required this.unsorted});
factory Sort.fromJson(Map<String, dynamic> json) {
return Sort(
sorted: json['sorted'],
empty: json['empty'],
unsorted: json['unsorted'],
);
}
Map<String, dynamic> toJson() {
return {'sorted': sorted, 'empty': empty, 'unsorted': unsorted};
}
}

View File

@@ -92,179 +92,203 @@ class _ConfirmScreenState extends State<ConfirmScreen>
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
padding: EdgeInsets.all(15),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border.all(
bottom: BorderSide( color: Theme.of(
width: 1.0, context,
color: Theme.of(context).colorScheme.primary, ).colorScheme.primary.withOpacity(0.3),
),
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1.0,
color:
Theme.of(context).colorScheme.primary,
),
),
),
padding: EdgeInsets.only(
bottom: 4.0,
), // Adjust spacing
child: Text(
"PROVIDER DETAILS",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
), ),
), ...controller
), .transactionController
padding: EdgeInsets.only( .model
bottom: 4.0, .confirmationData["additionalData"]
), // Adjust spacing .map<Widget>((data) {
child: Text( return Column(
"PROVIDER DETAILS", children: [
style: TextStyle( const SizedBox(height: 10),
fontSize: 16, Row(
fontWeight: FontWeight.bold, mainAxisAlignment:
), MainAxisAlignment.spaceBetween,
), children: [
), Text(
...controller data["name"] ?? "",
.transactionController style: TextStyle(
.model fontSize: 16,
.confirmationData["additionalData"] fontWeight: FontWeight.bold,
.map<Widget>((data) { ),
return Column( ),
children: [ Text(
const SizedBox(height: 10), data["value"] ?? "",
Row( style: TextStyle(fontSize: 16),
mainAxisAlignment: ),
MainAxisAlignment.spaceBetween, ],
children: [
Text(
data["name"] ?? "",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
), ),
), ],
Text( );
data["value"] ?? "", })
style: TextStyle(fontSize: 16), .toList(),
), const SizedBox(height: 30),
], Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1.0,
color:
Theme.of(context).colorScheme.primary,
),
),
),
padding: EdgeInsets.only(
bottom: 4.0,
), // Adjust spacing
child: Text(
"TRANSACTIONS DETAILS",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 20),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
"Amount",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
controller
.transactionController
.model
.confirmationData["amount"]
.toString(),
style: TextStyle(fontSize: 16),
), ),
], ],
);
})
.toList(),
const SizedBox(height: 30),
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1.0,
color: Theme.of(context).colorScheme.primary,
), ),
), const SizedBox(height: 10),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
"Our Charge",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
controller
.transactionController
.model
.confirmationData["charge"]
.toString(),
style: TextStyle(fontSize: 16),
),
],
),
const SizedBox(height: 10),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
"Gateway Charge",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
controller
.transactionController
.model
.confirmationData["gatewayCharge"]
.toString(),
style: TextStyle(fontSize: 16),
),
],
),
const SizedBox(height: 10),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
"Tax",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
controller
.transactionController
.model
.confirmationData["tax"]
.toString(),
style: TextStyle(fontSize: 16),
),
],
),
const SizedBox(height: 10),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
"Total Amount",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
controller
.transactionController
.model
.confirmationData["totalAmount"]
.toString(),
style: TextStyle(fontSize: 16),
),
],
),
],
), ),
padding: EdgeInsets.only(
bottom: 4.0,
), // Adjust spacing
child: Text(
"TRANSACTIONS DETAILS",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Amount",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
controller
.transactionController
.model
.confirmationData["amount"]
.toString(),
style: TextStyle(fontSize: 16),
),
],
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Our Charge",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
controller
.transactionController
.model
.confirmationData["charge"]
.toString(),
style: TextStyle(fontSize: 16),
),
],
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Gateway Charge",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
controller
.transactionController
.model
.confirmationData["gatewayCharge"]
.toString(),
style: TextStyle(fontSize: 16),
),
],
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Tax",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
controller
.transactionController
.model
.confirmationData["tax"]
.toString(),
style: TextStyle(fontSize: 16),
),
],
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Total Amount",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
controller
.transactionController
.model
.confirmationData["totalAmount"]
.toString(),
style: TextStyle(fontSize: 16),
),
],
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
_buildPaymentProcessorButton(), _buildPaymentProcessorButton(),

View File

@@ -1,7 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:qpay/http/http.dart'; import 'package:qpay/http/http.dart';
import 'package:qpay/models/pageable_model.dart';
class HistoryModel { class HistoryModel {
PageableModel? pageableModel;
List<Map<String, dynamic>> transactions = []; List<Map<String, dynamic>> transactions = [];
bool isLoading = false; bool isLoading = false;
String? errorMessage; String? errorMessage;
@@ -26,16 +29,29 @@ class HistoryController extends ChangeNotifier {
Future<void> getTransactions(Map<String, String> params) async { Future<void> getTransactions(Map<String, String> params) async {
model.isLoading = true; model.isLoading = true;
model.transactions = getFakeTransactions(); if (params['page'] == '0') {
model.transactions = getFakeTransactions();
}
notifyListeners(); notifyListeners();
try { try {
params['type'] = 'REQUEST'; params['type'] = 'REQUEST';
List<dynamic> response = await http.get( Map<String, dynamic> response = await http.get(
'/transaction?${buildQueryParameters(params)}', '/transaction?${buildQueryParameters(params)}',
); );
if (params['page'] == '0') {
model.transactions = [];
}
model.pageableModel = PageableModel.fromJson(response);
// pagination adds to current list instead of replacing it
model.transactions = model.transactions =
response.map((e) => e as Map<String, dynamic>).toList(); model.transactions +
model.pageableModel!.content
.map((e) => e as Map<String, dynamic>)
.toList();
} catch (e) { } catch (e) {
logger.e(e); logger.e(e);
_showErrorSnackBar( _showErrorSnackBar(

View File

@@ -24,6 +24,7 @@ class _HistoryScreenState extends State<HistoryScreen>
final TextEditingController _searchController = TextEditingController(); final TextEditingController _searchController = TextEditingController();
final Map<String, String> _queryParams = {}; final Map<String, String> _queryParams = {};
final List<Animation<Offset>> _alignListAnimations = []; final List<Animation<Offset>> _alignListAnimations = [];
final int _pageSize = 8;
@override @override
void initState() { void initState() {
@@ -57,7 +58,12 @@ class _HistoryScreenState extends State<HistoryScreen>
void setupData() async { void setupData() async {
prefs = await SharedPreferences.getInstance(); prefs = await SharedPreferences.getInstance();
await controller.getTransactions({'userId': prefs.getString("userId")!}); await controller.getTransactions({
'userId': prefs.getString("userId")!,
'page': '0',
'size': _pageSize.toString(),
'sort': 'createdAt,desc',
});
} }
@override @override
@@ -99,13 +105,38 @@ class _HistoryScreenState extends State<HistoryScreen>
], ],
), ),
if (controller.model.transactions.isNotEmpty) if (controller.model.transactions.isNotEmpty)
ListView( Column(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
children: [ children: [
...controller.model.transactions.map( ListView(
(e) => _buildTransactionItem(e, context), shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
children: [
...controller.model.transactions.map(
(e) => _buildTransactionItem(e, context),
),
],
), ),
SizedBox(height: 10),
if (controller.model.pageableModel != null &&
controller.model.pageableModel!.number <
controller.model.pageableModel!.totalPages)
OutlinedButton(
child: Text('Load more'),
onPressed: () {
controller.getTransactions({
'userId': prefs.getString("userId")!,
'page':
(controller
.model
.pageableModel!
.number +
1)
.toString(),
'size': _pageSize.toString(),
'sort': 'createdAt,desc',
});
},
),
], ],
), ),
], ],

View File

@@ -1,8 +1,7 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:logger/logger.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:qpay/http/http.dart'; import 'package:qpay/http/http.dart';
import 'package:qpay/models/pageable_model.dart';
part 'home_controller.freezed.dart'; part 'home_controller.freezed.dart';
part 'home_controller.g.dart'; part 'home_controller.g.dart';
@@ -116,11 +115,14 @@ class HomeController extends ChangeNotifier {
notifyListeners(); notifyListeners();
try { try {
List<dynamic> response = await http.get( Map<String, dynamic> response = await http.get(
'/transaction?userId=$userId&type=REQUEST', '/transaction?sort=createdAt,desc&size=3&page=0&userId=$userId&type=REQUEST',
); );
PageableModel pageableModel = PageableModel.fromJson(response);
model.transactions = model.transactions =
response.map((e) => e as Map<String, dynamic>).toList(); pageableModel.content.map((e) => e as Map<String, dynamic>).toList();
} catch (e) { } catch (e) {
logger.e(e); logger.e(e);
_showErrorSnackBar( _showErrorSnackBar(

View File

@@ -221,18 +221,6 @@ class _HomeScreenState extends State<HomeScreen>
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
TextButton(
onPressed: () {
context.go('/history');
},
child: Text(
'View All',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
),
], ],
), ),
const SizedBox(height: 5), const SizedBox(height: 5),
@@ -250,13 +238,26 @@ class _HomeScreenState extends State<HomeScreen>
], ],
), ),
if (homeController.model.transactions.isNotEmpty) if (homeController.model.transactions.isNotEmpty)
ListView( Column(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
children: [ children: [
...homeController.model.transactions.map( ListView(
(e) => _buildTransactionItem(e, context), shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
children: [
...homeController.model.transactions.map(
(e) => _buildTransactionItem(e, context),
),
],
), ),
SizedBox(height: 10),
if (homeController.model.transactions.length >
2)
OutlinedButton(
child: Text('View All'),
onPressed: () {
context.go('/history');
},
),
], ],
), ),
], ],

View File

@@ -189,7 +189,7 @@ class PayController extends ChangeNotifier {
void updatePhone(String phone) { void updatePhone(String phone) {
transactionController.model.formData = transactionController.model.formData transactionController.model.formData = transactionController.model.formData
.copyWith(creditPhone: phone); .copyWith(debitPhone: phone);
notifyListeners(); notifyListeners();
} }

View File

@@ -125,237 +125,240 @@ class _ReceiptScreenState extends State<ReceiptScreen>
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Skeletonizer(
padding: EdgeInsets.all(20), enabled: receiptController.model.isLoading,
decoration: BoxDecoration( child: Container(
gradient: LinearGradient( padding: EdgeInsets.all(20),
begin: Alignment.topLeft, decoration: BoxDecoration(
end: Alignment.bottomRight, gradient: LinearGradient(
colors: [ begin: Alignment.topLeft,
Theme.of( end: Alignment.bottomRight,
context, colors: [
).colorScheme.primary.withOpacity(0.1), Theme.of(context).colorScheme.primary
Theme.of(context).colorScheme.tertiary .withOpacity(0.1),
.withOpacity(0.05), Theme.of(context).colorScheme.tertiary
Theme.of(context).colorScheme.tertiary .withOpacity(0.05),
.withOpacity(0.15), Theme.of(context).colorScheme.tertiary
], .withOpacity(0.15),
stops: [0.0, 0.5, 1.0], ],
), stops: [0.0, 0.5, 1.0],
border: Border.all( ),
color: Theme.of( border: Border.all(
context,
).colorScheme.primary.withOpacity(0.3),
),
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Theme.of( color: Theme.of(
context, context,
).colorScheme.primary.withOpacity(0.1), ).colorScheme.primary.withOpacity(0.3),
blurRadius: 10,
spreadRadius: 1,
offset: Offset(0, 2),
), ),
], borderRadius: BorderRadius.circular(10),
), boxShadow: [
child: Column( BoxShadow(
crossAxisAlignment: color: Theme.of(context)
CrossAxisAlignment.center, .colorScheme
children: [ .primary
Row( .withOpacity(0.1),
mainAxisAlignment: blurRadius: 10,
MainAxisAlignment.center, spreadRadius: 1,
crossAxisAlignment: offset: Offset(0, 2),
CrossAxisAlignment.center, ),
children: [ ],
Icon( ),
transactionController child: Column(
.model crossAxisAlignment:
.receiptData?["status"] == CrossAxisAlignment.center,
'SUCCESS' children: [
? Icons.check_circle Row(
: transactionController mainAxisAlignment:
.model MainAxisAlignment.center,
.receiptData?["status"] == crossAxisAlignment:
'PENDING' CrossAxisAlignment.center,
? Icons.pending children: [
: Icons.cancel, Icon(
size: 18, transactionController
color: .model
transactionController .receiptData?["status"] ==
.model 'SUCCESS'
.receiptData?["status"] == ? Icons.check_circle
'SUCCESS' : transactionController
? Colors.green .model
: transactionController .receiptData?["status"] ==
.model 'PENDING'
.receiptData?["status"] == ? Icons.pending
'PENDING' : Icons.cancel,
? Colors.orange size: 18,
: Colors.red, color:
), transactionController
SizedBox(width: 5), .model
Text( .receiptData?["status"] ==
receiptController 'SUCCESS'
.model ? Colors.green
.receiptData?["debitCurrency"] ?? : transactionController
"", .model
style: TextStyle( .receiptData?["status"] ==
fontSize: 26, 'PENDING'
fontWeight: FontWeight.bold, ? Colors.orange
: Colors.red,
), ),
), SizedBox(width: 5),
SizedBox(width: 5), Text(
Text( receiptController
receiptController .model
.model .receiptData?["debitCurrency"] ??
.receiptData?["totalAmount"] "",
.toStringAsFixed(2) ?? style: TextStyle(
"", fontSize: 26,
style: TextStyle(fontSize: 26), fontWeight: FontWeight.bold,
), ),
], ),
), SizedBox(width: 5),
Column( Text(
crossAxisAlignment: receiptController
CrossAxisAlignment.center, .model
children: [ .receiptData?["totalAmount"]
SizedBox(height: 5), .toStringAsFixed(2) ??
// receiptController "",
// .model style: TextStyle(fontSize: 26),
// .receiptData?["providerImage"] != ),
// null ],
// ? Image.asset( ),
// 'assets/${receiptController.model.receiptData?["providerImage"] ?? ''}', Column(
// width: 50, crossAxisAlignment:
// ) CrossAxisAlignment.center,
// : SizedBox.shrink(), children: [
Text( SizedBox(height: 5),
receiptController // receiptController
.model // .model
.receiptData?["billName"] ?? // .receiptData?["providerImage"] !=
"", // null
style: TextStyle(fontSize: 14), // ? Image.asset(
), // 'assets/${receiptController.model.receiptData?["providerImage"] ?? ''}',
], // width: 50,
), // )
SizedBox(height: 10), // : SizedBox.shrink(),
Row( Text(
mainAxisAlignment: receiptController
MainAxisAlignment.spaceEvenly, .model
children: [ .receiptData?["billName"] ??
Column( "",
children: [ style: TextStyle(fontSize: 14),
Container( ),
width: 50, ],
height: 50, ),
decoration: BoxDecoration( SizedBox(height: 10),
shape: BoxShape.circle, Row(
color: Colors.white, mainAxisAlignment:
border: Border.all( MainAxisAlignment.spaceEvenly,
color: Theme.of(context) children: [
.colorScheme Column(
.primary children: [
.withOpacity(0.3), Container(
width: 1, width: 50,
height: 50,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
border: Border.all(
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.3),
width: 1,
),
), ),
), child:
child: receiptController
receiptController .model
.model .isLoading
.isLoading ? Center(
? Center( child: SizedBox(
child: SizedBox( width: 24,
width: 24, height: 24,
height: 24, child: CircularProgressIndicator(
child: CircularProgressIndicator( strokeWidth:
strokeWidth: 2.5, 2.5,
valueColor: valueColor: AlwaysStoppedAnimation<
AlwaysStoppedAnimation< Color
Color >(
>( Theme.of(
Theme.of( context,
context, )
) .colorScheme
.colorScheme .primary,
.primary, ),
), ),
),
)
: IconButton(
onPressed: () {
receiptController
.repeatTransaction(
context,
);
},
icon: Icon(
Icons.repeat,
color:
Theme.of(
context,
)
.colorScheme
.primary,
size: 24,
), ),
), ),
)
: IconButton(
onPressed: () {
receiptController
.repeatTransaction(
context,
);
},
icon: Icon(
Icons.repeat,
color:
Theme.of(
context,
)
.colorScheme
.primary,
size: 24,
),
),
),
SizedBox(height: 8),
Text(
"Repeat",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
), ),
), SizedBox(height: 8),
], Text(
), "Repeat",
Column( style: TextStyle(
children: [ fontSize: 14,
Container( fontWeight: FontWeight.w500,
width: 50,
height: 50,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
border: Border.all(
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.3),
width: 1,
), ),
), ),
child: IconButton( ],
onPressed: () { ),
_captureImage(); Column(
}, children: [
icon: Icon( Container(
Icons.share, width: 50,
color: height: 50,
Theme.of( decoration: BoxDecoration(
context, shape: BoxShape.circle,
).colorScheme.primary, color: Colors.white,
size: 24, border: Border.all(
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.3),
width: 1,
),
),
child: IconButton(
onPressed: () {
_captureImage();
},
icon: Icon(
Icons.share,
color:
Theme.of(
context,
).colorScheme.primary,
size: 24,
),
), ),
), ),
), SizedBox(height: 8),
SizedBox(height: 8), Text(
Text( "Share",
"Share", style: TextStyle(
style: TextStyle( fontSize: 14,
fontSize: 14, fontWeight: FontWeight.w500,
fontWeight: FontWeight.w500, ),
), ),
), ],
], ),
), ],
], ),
), ],
], ),
), ),
), ),
SizedBox(height: 20), SizedBox(height: 20),
@@ -405,247 +408,325 @@ class _ReceiptScreenState extends State<ReceiptScreen>
SizedBox( SizedBox(
height: height:
MediaQuery.of(context).size.height * MediaQuery.of(context).size.height *
0.4, 0.5,
child: TabBarView( child: TabBarView(
controller: _tabController, controller: _tabController,
children: <Widget>[ children: <Widget>[
Column( Padding(
children: [ padding: const EdgeInsets.all(10.0),
const SizedBox(height: 20), child: Column(
if (receiptController children: [
.model
.receiptData?["additionalData"] ==
null)
Skeletonizer( Skeletonizer(
enabled: enabled:
receiptController receiptController
.model .model
.isLoading, .isLoading,
child: Column( child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [ children: [
SizedBox(height: 20), Text(
Center( "Status",
child: Text( style: TextStyle(
"No details found", fontSize: 16,
fontWeight:
FontWeight.bold,
),
),
Text(
transactionController
.model
.receiptData?["status"] ??
"",
style: TextStyle(
fontSize: 16,
), ),
), ),
], ],
), ),
), ),
if (receiptController const SizedBox(height: 10),
Skeletonizer(
enabled:
receiptController
.model
.isLoading,
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
"From",
style: TextStyle(
fontSize: 16,
fontWeight:
FontWeight.bold,
),
),
Text(
receiptController
.model
.receiptData?["debitPhone"] ??
"",
style: TextStyle(
fontSize: 16,
),
),
],
),
),
const SizedBox(height: 10),
Skeletonizer(
enabled:
receiptController
.model
.isLoading,
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
"To",
style: TextStyle(
fontSize: 16,
fontWeight:
FontWeight.bold,
),
),
Text(
receiptController
.model
.receiptData?["creditAccount"] ??
"",
style: TextStyle(
fontSize: 16,
),
),
],
),
),
const SizedBox(height: 10),
Divider(
color: Colors.grey[300],
thickness: 1,
),
const SizedBox(height: 10),
if (receiptController
.model
.receiptData?["additionalData"] ==
null)
Skeletonizer(
enabled:
receiptController
.model
.isLoading,
child: Column(
children: [
SizedBox(height: 20),
Center(
child: Text(
"No details found",
),
),
],
),
),
if (receiptController
.model
.receiptData?["additionalData"] !=
null)
...receiptController
.model .model
.receiptData?["additionalData"] != .receiptData?["additionalData"]
null) .map<Widget>((data) {
...receiptController return Column(
.model children: [
.receiptData?["additionalData"] Row(
.map<Widget>((data) { mainAxisAlignment:
return Column( MainAxisAlignment
children: [ .spaceBetween,
Row( children: [
mainAxisAlignment: Text(
MainAxisAlignment data["name"] ??
.spaceBetween, "",
children: [ style: TextStyle(
Text( fontSize:
data["name"] ?? 16,
"", fontWeight:
style: TextStyle( FontWeight
fontSize: 16, .bold,
fontWeight: ),
FontWeight
.bold,
), ),
), Text(
Text( data["value"] ??
data["value"] ?? "",
"", style:
style: TextStyle(
TextStyle( fontSize:
fontSize: 16,
16, ),
), ),
), ],
], ),
), const SizedBox(
const SizedBox( height: 10,
height: 10, ),
), ],
], );
); })
}) .toList(),
.toList(), ],
], ),
), ),
Column( Padding(
children: [ padding: const EdgeInsets.all(10.0),
const SizedBox(height: 20), child: Column(
Row( children: [
mainAxisAlignment: Row(
MainAxisAlignment mainAxisAlignment:
.spaceBetween, MainAxisAlignment
children: [ .spaceBetween,
Text( children: [
"Status", Text(
style: TextStyle( "Amount",
fontSize: 16, style: TextStyle(
fontWeight: fontSize: 16,
FontWeight.bold, fontWeight:
FontWeight.bold,
),
), ),
), Text(
Text( transactionController
transactionController .model
.model .receiptData?["amount"]
.receiptData?["status"] ?? .toStringAsFixed(
"", 2,
style: TextStyle( ) ??
fontSize: 16, "0.00",
style: TextStyle(
fontSize: 16,
),
), ),
), ],
], ),
), const SizedBox(height: 10),
const SizedBox(height: 10), Row(
Row( mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment
MainAxisAlignment .spaceBetween,
.spaceBetween, children: [
children: [ Text(
Text( "Our Charge",
"Amount", style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, fontWeight:
fontWeight: FontWeight.bold,
FontWeight.bold, ),
), ),
), Text(
Text( transactionController
transactionController .model
.model .receiptData?["charge"]
.receiptData?["amount"] .toStringAsFixed(
.toStringAsFixed( 2,
2, ) ??
) ?? "0.00",
"0.00", style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, ),
), ),
), ],
], ),
), const SizedBox(height: 10),
const SizedBox(height: 10), Row(
Row( mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment
MainAxisAlignment .spaceBetween,
.spaceBetween, children: [
children: [ Text(
Text( "Gateway Charge",
"Our Charge", style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, fontWeight:
fontWeight: FontWeight.bold,
FontWeight.bold, ),
), ),
), Text(
Text( transactionController
transactionController .model
.model .receiptData?["gatewayCharge"]
.receiptData?["charge"] .toStringAsFixed(
.toStringAsFixed( 2,
2, ) ??
) ?? "0.00",
"0.00", style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, ),
), ),
), ],
], ),
), const SizedBox(height: 10),
const SizedBox(height: 10), Row(
Row( mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment
MainAxisAlignment .spaceBetween,
.spaceBetween, children: [
children: [ Text(
Text( "Tax",
"Gateway Charge", style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, fontWeight:
fontWeight: FontWeight.bold,
FontWeight.bold, ),
), ),
), Text(
Text( transactionController
transactionController .model
.model .receiptData?["tax"]
.receiptData?["gatewayCharge"] .toStringAsFixed(
.toStringAsFixed( 2,
2, ) ??
) ?? "0.00",
"0.00", style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, ),
), ),
), ],
], ),
), const SizedBox(height: 10),
const SizedBox(height: 10), Row(
Row( mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment
MainAxisAlignment .spaceBetween,
.spaceBetween, children: [
children: [ Text(
Text( "Total Amount",
"Tax", style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, fontWeight:
fontWeight: FontWeight.bold,
FontWeight.bold, ),
), ),
), Text(
Text( transactionController
transactionController .model
.model .receiptData?["totalAmount"]
.receiptData?["tax"] .toStringAsFixed(
.toStringAsFixed( 2,
2, ) ??
) ?? "0.00",
"0.00", style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, ),
), ),
), ],
], ),
), const SizedBox(height: 20),
const SizedBox(height: 10), ],
Row( ),
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
"Total Amount",
style: TextStyle(
fontSize: 16,
fontWeight:
FontWeight.bold,
),
),
Text(
transactionController
.model
.receiptData?["totalAmount"]
.toStringAsFixed(
2,
) ??
"0.00",
style: TextStyle(
fontSize: 16,
),
),
],
),
const SizedBox(height: 20),
],
), ),
], ],
), ),