102 lines
3.3 KiB
Dart
102 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/rendering.dart';
|
|
import '../widgets/finance_summary_card.dart';
|
|
import '../widgets/work_day_card.dart';
|
|
import '../widgets/settings_bar.dart';
|
|
|
|
class FinanceScreen extends StatefulWidget {
|
|
final void Function(bool isScrollingDown)? onScrollEvent;
|
|
|
|
const FinanceScreen({super.key, this.onScrollEvent});
|
|
|
|
@override
|
|
State<FinanceScreen> createState() => _FinanceScreenState();
|
|
}
|
|
|
|
class _FinanceScreenState extends State<FinanceScreen> {
|
|
String dropdownValue = "الكل";
|
|
bool _showSettings = true; // local control of settings bar
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Directionality(
|
|
textDirection: TextDirection.rtl,
|
|
child: Stack(
|
|
children: [
|
|
/// --------------------------------------------------
|
|
/// SETTINGS BAR (STATIC, INSIDE THE SCREEN)
|
|
/// --------------------------------------------------
|
|
AnimatedPositioned(
|
|
duration: const Duration(milliseconds: 250),
|
|
top: _showSettings ? 0 : -80,
|
|
left: 0,
|
|
right: 0,
|
|
child: SafeArea(
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(top: 8),
|
|
child: SettingsBar(
|
|
selectedIndex: 0,
|
|
showBackButton: false,
|
|
iconPaths: [
|
|
'assets/images/user.svg',
|
|
'assets/images/ball.svg',
|
|
],
|
|
onTap: (index) {
|
|
// Your logic here
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
/// --------------------------------------------------
|
|
/// MAIN CONTENT - LIST
|
|
/// --------------------------------------------------
|
|
Positioned.fill(
|
|
top: 70, // space for SettingsBar
|
|
child: NotificationListener<UserScrollNotification>(
|
|
onNotification: (notif) {
|
|
if (notif.direction == ScrollDirection.reverse) {
|
|
setState(() => _showSettings = false);
|
|
widget.onScrollEvent?.call(true);
|
|
} else if (notif.direction == ScrollDirection.forward) {
|
|
setState(() => _showSettings = true);
|
|
widget.onScrollEvent?.call(false);
|
|
}
|
|
return true;
|
|
},
|
|
|
|
child: ListView(
|
|
padding: const EdgeInsets.only(
|
|
top: 0,
|
|
bottom: 120),
|
|
children: [
|
|
/// SUMMARY CARD
|
|
FinanceSummaryCard(
|
|
totalAmount: "333,000",
|
|
dropdownValue: dropdownValue,
|
|
onCalendarTap: () => showDatePicker(
|
|
context: context,
|
|
initialDate: DateTime.now(),
|
|
firstDate: DateTime(2020),
|
|
lastDate: DateTime(2030),
|
|
),
|
|
onDropdownChanged: (value) {
|
|
setState(() => dropdownValue = value!);
|
|
},
|
|
),
|
|
|
|
/// WORK DAY CARDS
|
|
const WorkDayCard(),
|
|
const WorkDayCard(),
|
|
const WorkDayCard(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|