Removed helpers lib and updated to flutter 3.22
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:helpers/helpers/misc_build/build_media.dart';
|
||||
import 'package:rluv/features/budget/widgets/transaction_list_item.dart';
|
||||
import 'package:rluv/global/styles.dart';
|
||||
import 'package:rluv/models/transaction_model.dart';
|
||||
@@ -12,8 +11,7 @@ class TransactionsListview extends ConsumerStatefulWidget {
|
||||
const TransactionsListview({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<TransactionsListview> createState() =>
|
||||
_TransactionsListviewState();
|
||||
ConsumerState<TransactionsListview> createState() => _TransactionsListviewState();
|
||||
}
|
||||
|
||||
class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
@@ -23,8 +21,7 @@ class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
ref.read(selectedTransactionSortProvider.notifier).state =
|
||||
TransactionSort.all;
|
||||
ref.read(selectedTransactionSortProvider.notifier).state = TransactionSort.all;
|
||||
ref.read(selectedSortDateProvider.notifier).state = SortDate.decending;
|
||||
});
|
||||
super.initState();
|
||||
@@ -34,8 +31,8 @@ class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
Widget build(BuildContext context) {
|
||||
final budgetCategories = ref.watch(budgetCategoriesProvider);
|
||||
if (ref.read(selectedCategory) == null && budgetCategories.isNotEmpty) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) =>
|
||||
ref.read(selectedCategory.notifier).state = budgetCategories.first);
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) => ref.read(selectedCategory.notifier).state = budgetCategories.first);
|
||||
}
|
||||
final sortType = ref.watch(selectedTransactionSortProvider);
|
||||
final sortDate = ref.watch(selectedSortDateProvider);
|
||||
@@ -60,8 +57,7 @@ class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
if (ref.read(selectedCategory) != null) {
|
||||
transactions = transactions
|
||||
.where(
|
||||
(element) =>
|
||||
element.budgetCategoryId == ref.read(selectedCategory)!.id,
|
||||
(element) => element.budgetCategoryId == ref.read(selectedCategory)!.id,
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
@@ -79,15 +75,15 @@ class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
break;
|
||||
}
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) =>
|
||||
ref.read(transactionHistoryListProvider.notifier).state = transactions);
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) => ref.read(transactionHistoryListProvider.notifier).state = transactions);
|
||||
return Scaffold(
|
||||
endDrawer: Drawer(
|
||||
backgroundColor: Styles.purpleNurple,
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: BuildMedia(context).height * 0.15),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.15),
|
||||
DropdownButton<TransactionSort>(
|
||||
dropdownColor: Styles.lavender,
|
||||
value: ref.watch(selectedTransactionSortProvider),
|
||||
@@ -108,8 +104,7 @@ class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
.toList(),
|
||||
onChanged: (TransactionSort? value) {
|
||||
if (value != null) {
|
||||
ref.read(selectedTransactionSortProvider.notifier).state =
|
||||
value;
|
||||
ref.read(selectedTransactionSortProvider.notifier).state = value;
|
||||
}
|
||||
}),
|
||||
const SizedBox(height: 20),
|
||||
@@ -137,8 +132,7 @@ class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
}
|
||||
}),
|
||||
const SizedBox(height: 20),
|
||||
if (ref.read(selectedTransactionSortProvider) ==
|
||||
TransactionSort.category)
|
||||
if (ref.read(selectedTransactionSortProvider) == TransactionSort.category)
|
||||
DropdownButton<BudgetCategory>(
|
||||
dropdownColor: Styles.lavender,
|
||||
value: ref.watch(selectedCategory),
|
||||
@@ -154,8 +148,7 @@ class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
width: 18,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: Colors.black, width: 1.5),
|
||||
border: Border.all(color: Colors.black, width: 1.5),
|
||||
color: e.color,
|
||||
),
|
||||
),
|
||||
@@ -186,9 +179,7 @@ class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
alignment: Alignment.topLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 16.0),
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.chevron_left),
|
||||
onPressed: () => Navigator.pop(context)),
|
||||
child: IconButton(icon: const Icon(Icons.chevron_left), onPressed: () => Navigator.pop(context)),
|
||||
),
|
||||
),
|
||||
const Center(
|
||||
@@ -201,14 +192,11 @@ class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 16.0),
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.chevron_left),
|
||||
onPressed: () => Navigator.pop(context)),
|
||||
child: IconButton(icon: const Icon(Icons.chevron_left), onPressed: () => Navigator.pop(context)),
|
||||
),
|
||||
const Spacer(),
|
||||
const Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 18.0, horizontal: 0.0),
|
||||
padding: EdgeInsets.symmetric(vertical: 18.0, horizontal: 0.0),
|
||||
child: Text(
|
||||
'Transaction History',
|
||||
style: TextStyle(fontSize: 28),
|
||||
@@ -245,8 +233,7 @@ class _TransactionsListviewState extends ConsumerState<TransactionsListview> {
|
||||
}
|
||||
|
||||
void toggleDrawer() {
|
||||
if (scaffoldKey.currentState != null &&
|
||||
scaffoldKey.currentState!.isDrawerOpen) {
|
||||
if (scaffoldKey.currentState != null && scaffoldKey.currentState!.isDrawerOpen) {
|
||||
scaffoldKey.currentState!.openDrawer();
|
||||
} else if (scaffoldKey.currentState != null) {
|
||||
scaffoldKey.currentState!.openEndDrawer();
|
||||
@@ -292,8 +279,7 @@ final selectedTransactionSortProvider = StateProvider<TransactionSort>(
|
||||
(ref) => TransactionSort.all,
|
||||
);
|
||||
|
||||
final selectedSortDateProvider =
|
||||
StateProvider<SortDate>((ref) => SortDate.decending);
|
||||
final selectedSortDateProvider = StateProvider<SortDate>((ref) => SortDate.decending);
|
||||
|
||||
final transactionHistoryListProvider = StateProvider<List<Transaction>>(
|
||||
(ref) => [],
|
||||
|
||||
Reference in New Issue
Block a user