You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_Patient_App/lib/widgets/drawer/drawer_item_widget.dart

99 lines
3.7 KiB
Dart

import 'dart:ui';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:hmg_patient_app/config/size_config.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/theme/colors.dart';
import 'package:hmg_patient_app/widgets/text/app_texts_widget.dart';
import 'package:flutter/material.dart';
///
class DrawerItem extends StatefulWidget {
final String? title;
final String? subTitle;
final icon;
final Color? textColor;
final Color? iconColor;
final bool? bottomLine;
final bool? sideArrow;
final Widget? count;
final bool? isImageIcon;
final double? fontHeight;
final double? letterSpacing;
final double? fontSize;
final ProjectViewModel? projectProvider;
DrawerItem(this.title, this.icon,
{this.fontSize, this.letterSpacing, this.textColor, this.iconColor, this.subTitle = '', this.bottomLine = true, this.count, this.sideArrow = false, this.isImageIcon = false, this.fontHeight, this.projectProvider});
@override
_DrawerItemState createState() => _DrawerItemState();
}
class _DrawerItemState extends State<DrawerItem> {
@override
Widget build(BuildContext context) {
return Container(
decoration: widget.bottomLine == true
? BoxDecoration(
border: Border(
bottom: BorderSide(
// <--- left side
color: Colors.grey[200]!,
width: 1.0,
),
))
: BoxDecoration(),
child: Padding(
padding: EdgeInsets.all(10),
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: widget.isImageIcon == true
? widget.icon
: Icon(
widget.icon,
color: widget.iconColor == null ? CustomColors.black : widget.iconColor,
size: SizeConfig.imageSizeMultiplier! * 5,
)),
Expanded(
flex: 7,
child: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Row(
children: [
AutoSizeText(
widget.title!,
maxLines: 1,
minFontSize: 10,
style: TextStyle(
fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w600,
letterSpacing: -0.39,
height: 0.8,
),
),
// AppText(
// widget.title!,
// fontWeight: FontWeight.w600,
// fontSize: widget.fontSize,
// height: widget.fontHeight,
// letterSpacing: widget.letterSpacing,
// ),
widget.count ?? SizedBox(),
],
),
widget.subTitle != ''
? AppText(
widget.subTitle!,
fontSize: SizeConfig.textMultiplier! * 2.5,
)
: SizedBox(),
])),
widget.sideArrow == true ? Expanded(flex: 1, child: Icon(widget.projectProvider!.isArabic ? Icons.keyboard_arrow_left : Icons.keyboard_arrow_right, color: Colors.black)) : Expanded(flex: 1, child: SizedBox()),
],
),
));
}
}