|
|
|
@ -5,18 +5,22 @@ import 'package:flutter/material.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/app_export.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/app_export.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
|
|
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
|
|
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class CollapsingListView extends StatelessWidget {
|
|
|
|
class CollapsingListView extends StatelessWidget {
|
|
|
|
final String title;
|
|
|
|
final String title;
|
|
|
|
Widget? child;
|
|
|
|
Widget? child;
|
|
|
|
VoidCallback? search;
|
|
|
|
VoidCallback? search;
|
|
|
|
|
|
|
|
VoidCallback? report;
|
|
|
|
|
|
|
|
VoidCallback? logout;
|
|
|
|
Widget? bottomChild;
|
|
|
|
Widget? bottomChild;
|
|
|
|
bool isClose;
|
|
|
|
bool isClose;
|
|
|
|
|
|
|
|
|
|
|
|
CollapsingListView({required this.title, this.child, this.search, this.isClose = false, this.bottomChild});
|
|
|
|
CollapsingListView({required this.title, this.child, this.search, this.isClose = false, this.bottomChild, this.report, this.logout});
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
@ -30,6 +34,7 @@ class CollapsingListView extends StatelessWidget {
|
|
|
|
pinned: true,
|
|
|
|
pinned: true,
|
|
|
|
expandedHeight: 100,
|
|
|
|
expandedHeight: 100,
|
|
|
|
stretch: true,
|
|
|
|
stretch: true,
|
|
|
|
|
|
|
|
surfaceTintColor: Colors.transparent,
|
|
|
|
backgroundColor: AppColors.bgScaffoldColor,
|
|
|
|
backgroundColor: AppColors.bgScaffoldColor,
|
|
|
|
leading: IconButton(
|
|
|
|
leading: IconButton(
|
|
|
|
icon: Utils.buildSvgWithAssets(icon: isClose ? AppAssets.closeBottomNav : AppAssets.arrow_back, width: 32.h, height: 32.h),
|
|
|
|
icon: Utils.buildSvgWithAssets(icon: isClose ? AppAssets.closeBottomNav : AppAssets.arrow_back, width: 32.h, height: 32.h),
|
|
|
|
@ -44,6 +49,7 @@ class CollapsingListView extends StatelessWidget {
|
|
|
|
t = t - 1;
|
|
|
|
t = t - 1;
|
|
|
|
if (t < 0.7) t = 0.7;
|
|
|
|
if (t < 0.7) t = 0.7;
|
|
|
|
t = t.clamp(0.0, 1.0);
|
|
|
|
t = t.clamp(0.0, 1.0);
|
|
|
|
|
|
|
|
print("t:$t");
|
|
|
|
|
|
|
|
|
|
|
|
final double fontSize = lerpDouble(14, 18, t)!;
|
|
|
|
final double fontSize = lerpDouble(14, 18, t)!;
|
|
|
|
final double bottomPadding = lerpDouble(0, 0, t)!;
|
|
|
|
final double bottomPadding = lerpDouble(0, 0, t)!;
|
|
|
|
@ -58,10 +64,7 @@ class CollapsingListView extends StatelessWidget {
|
|
|
|
t,
|
|
|
|
t,
|
|
|
|
)!,
|
|
|
|
)!,
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
padding: EdgeInsets.only(left: leftPadding, bottom: bottomPadding),
|
|
|
|
left: leftPadding,
|
|
|
|
|
|
|
|
bottom: bottomPadding,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
spacing: 4.h,
|
|
|
|
spacing: 4.h,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
@ -78,6 +81,8 @@ class CollapsingListView extends StatelessWidget {
|
|
|
|
color: AppColors.blackColor,
|
|
|
|
color: AppColors.blackColor,
|
|
|
|
letterSpacing: -0.5),
|
|
|
|
letterSpacing: -0.5),
|
|
|
|
).expanded,
|
|
|
|
).expanded,
|
|
|
|
|
|
|
|
if (logout != null) actionButton(context, t, title: "Logout".needTranslation, icon: AppAssets.report_icon).onPress(logout!),
|
|
|
|
|
|
|
|
if (report != null) actionButton(context, t, title: "Report".needTranslation, icon: AppAssets.report_icon).onPress(report!),
|
|
|
|
if (search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(search!).paddingOnly(right: 24)
|
|
|
|
if (search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(search!).paddingOnly(right: 24)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
@ -100,4 +105,42 @@ class CollapsingListView extends StatelessWidget {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget actionButton(BuildContext context, double t, {required String title, required String icon}) {
|
|
|
|
|
|
|
|
return AnimatedSize(
|
|
|
|
|
|
|
|
duration: Duration(milliseconds: 150),
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
height: 40,
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(8),
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(right: 24),
|
|
|
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
|
|
|
color: AppColors.secondaryLightRedColor,
|
|
|
|
|
|
|
|
borderRadius: 12,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
spacing: 8.h,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Utils.buildSvgWithAssets(icon: icon, iconColor: AppColors.primaryRedColor),
|
|
|
|
|
|
|
|
if (t == 1)
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
title,
|
|
|
|
|
|
|
|
style: context.dynamicTextStyle(
|
|
|
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
|
|
|
letterSpacing: -0.4,
|
|
|
|
|
|
|
|
fontSize: (14 - (2 * (1 - t))).fSize,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.lerp(
|
|
|
|
|
|
|
|
FontWeight.w300,
|
|
|
|
|
|
|
|
FontWeight.w500,
|
|
|
|
|
|
|
|
t,
|
|
|
|
|
|
|
|
)!,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|