journal_list_tile.dart
parent
af22647320
commit
0160f1c4ae
|
|
@ -0,0 +1,4 @@
|
|||
storePassword=qwe123
|
||||
keyPassword=qwe123
|
||||
keyAlias=key0
|
||||
storeFile=../../../../keystore/AmanSystemsKey
|
||||
|
|
@ -78,6 +78,6 @@ Future<void> loadJournalData(Store<AppState> store) async {
|
|||
)));
|
||||
} catch (e, stack)
|
||||
{
|
||||
log.e('loadSellData', e, stack);
|
||||
log.e('loadJournalData', e, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:satu/shared/app_colors.dart';
|
||||
|
||||
class JournalTile extends StatelessWidget {
|
||||
const JournalTile({
|
||||
required this.title,
|
||||
required this.subTitle,
|
||||
this.received = true,
|
||||
this.amount = 0,
|
||||
this.date = '01.01.2000',
|
||||
Key? key,
|
||||
|
||||
this.onPress,
|
||||
}) : super(key: key);
|
||||
|
||||
final String title;
|
||||
final String subTitle;
|
||||
final bool received;
|
||||
final double amount;
|
||||
final String date;
|
||||
final Function()? onPress;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(color: whiteColor),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: onPress,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(fontSize: 12, color: textColor),
|
||||
),
|
||||
Text(
|
||||
subTitle,
|
||||
style: const TextStyle(
|
||||
fontSize: 10, color: placeholderColor)),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
' ${received ? '+' : '-'} $amount ₸',
|
||||
style: TextStyle(
|
||||
color: received ? Colors.green : Colors.red,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
date,
|
||||
style: const TextStyle(
|
||||
fontSize: 10, color: placeholderColor)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import 'package:satu/core/redux/store.dart';
|
|||
import 'package:satu/shared/app_colors.dart';
|
||||
import 'package:satu/widgets/bar/products_app_bar.dart';
|
||||
import 'package:satu/widgets/buttons/option_pill.dart';
|
||||
import 'component/journal_list_tile.dart';
|
||||
import 'component/transaction_item.dart';
|
||||
|
||||
class JournalView extends StatefulWidget {
|
||||
|
|
@ -33,13 +34,15 @@ class _JournalViewState extends State<JournalView> {
|
|||
body: StoreConnector<AppState, JournalState>(
|
||||
converter: (store) => store.state.journalState!,
|
||||
builder: (context, snapshot) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Column(
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: whiteColor
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
|
@ -73,39 +76,48 @@ class _JournalViewState extends State<JournalView> {
|
|||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: GroupedListView<TransactionDao, String>(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
elements: snapshot.items!,
|
||||
groupBy: (element) => element.day!,
|
||||
groupSeparatorBuilder: (String groupByValue) => Text(
|
||||
groupSeparatorBuilder: (String groupByValue) => Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15.0, bottom: 5.0, top: 20.0),
|
||||
child: Text(
|
||||
groupByValue,
|
||||
style: const TextStyle(
|
||||
color: textColor,
|
||||
fontSize: 14,
|
||||
color: placeholderColor,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
separator: const Divider(
|
||||
height: 1,
|
||||
color: disableColor,
|
||||
),
|
||||
itemBuilder: (context, TransactionDao element) =>
|
||||
TransactionItem(
|
||||
fullName: 'Чек № ${element.number} ${element.date}',
|
||||
status: element.contragentName,
|
||||
amount: element.total.toString(),
|
||||
JournalTile(
|
||||
title: '№ ${element.number}',
|
||||
subTitle: element.contragentName,
|
||||
date: element.date!,
|
||||
amount: element.total,
|
||||
received: element.received,
|
||||
),
|
||||
itemComparator: (item1, item2) =>
|
||||
item1.day!.compareTo(item2.day!),
|
||||
// optional
|
||||
useStickyGroupSeparators: true,
|
||||
stickyHeaderBackgroundColor: backgroundColor,
|
||||
// optional
|
||||
floatingHeader: true,
|
||||
|
||||
//floatingHeader: true,
|
||||
// optional
|
||||
order: GroupedListOrder.DESC, // optional
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue