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)
|
} 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/shared/app_colors.dart';
|
||||||
import 'package:satu/widgets/bar/products_app_bar.dart';
|
import 'package:satu/widgets/bar/products_app_bar.dart';
|
||||||
import 'package:satu/widgets/buttons/option_pill.dart';
|
import 'package:satu/widgets/buttons/option_pill.dart';
|
||||||
|
import 'component/journal_list_tile.dart';
|
||||||
import 'component/transaction_item.dart';
|
import 'component/transaction_item.dart';
|
||||||
|
|
||||||
class JournalView extends StatefulWidget {
|
class JournalView extends StatefulWidget {
|
||||||
|
|
@ -33,13 +34,15 @@ class _JournalViewState extends State<JournalView> {
|
||||||
body: StoreConnector<AppState, JournalState>(
|
body: StoreConnector<AppState, JournalState>(
|
||||||
converter: (store) => store.state.journalState!,
|
converter: (store) => store.state.journalState!,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
return Padding(
|
return Column(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
decoration: const BoxDecoration(
|
||||||
|
color: whiteColor
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -73,39 +76,48 @@ class _JournalViewState extends State<JournalView> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GroupedListView<TransactionDao, String>(
|
child: GroupedListView<TransactionDao, String>(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
elements: snapshot.items!,
|
elements: snapshot.items!,
|
||||||
groupBy: (element) => element.day!,
|
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,
|
groupByValue,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: textColor,
|
color: placeholderColor,
|
||||||
fontSize: 14,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
separator: const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: disableColor,
|
||||||
|
),
|
||||||
itemBuilder: (context, TransactionDao element) =>
|
itemBuilder: (context, TransactionDao element) =>
|
||||||
TransactionItem(
|
JournalTile(
|
||||||
fullName: 'Чек № ${element.number} ${element.date}',
|
title: '№ ${element.number}',
|
||||||
status: element.contragentName,
|
subTitle: element.contragentName,
|
||||||
amount: element.total.toString(),
|
date: element.date!,
|
||||||
|
amount: element.total,
|
||||||
received: element.received,
|
received: element.received,
|
||||||
),
|
),
|
||||||
itemComparator: (item1, item2) =>
|
itemComparator: (item1, item2) =>
|
||||||
item1.day!.compareTo(item2.day!),
|
item1.day!.compareTo(item2.day!),
|
||||||
// optional
|
// optional
|
||||||
useStickyGroupSeparators: true,
|
useStickyGroupSeparators: true,
|
||||||
|
stickyHeaderBackgroundColor: backgroundColor,
|
||||||
// optional
|
// optional
|
||||||
floatingHeader: true,
|
//floatingHeader: true,
|
||||||
|
|
||||||
// optional
|
// optional
|
||||||
order: GroupedListOrder.DESC, // optional
|
order: GroupedListOrder.DESC, // optional
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue