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.
diplomatic-quarter/lib/pages/pharmacies/widgets/lakum_point_table_row_widge...

117 lines
3.8 KiB
Dart

import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/points-expandable-notifier.dart';
import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
class LakumPointTableRowWidget extends StatefulWidget {
final bool isTableTitle; // true : title , false: row
final String rowTitle;
final double points;
final double riyal;
final Function onTap;
final int rowIndex;
final Widget collapsed;
final bool expandFlag;
LakumPointTableRowWidget(this.isTableTitle, this.rowTitle, this.points,
this.riyal, this.onTap, this.rowIndex,
{this.collapsed, this.expandFlag = false});
@override
_LakumPointTableRowWidgetState createState() =>
_LakumPointTableRowWidgetState();
}
class _LakumPointTableRowWidgetState extends State<LakumPointTableRowWidget> {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: widget.onTap,
child: Column(
children: <Widget>[
Column(
children: [
widget.collapsed != null
? PointsExpandableNotifier(
headerWidget: buildPointRowBody(),
// bodyWidget: widget.collapsed != null ? widget.collapsed : null,
bodyWidget: widget.collapsed,
isExpand: widget.expandFlag,
)
: buildPointRowBody(),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 1,
thickness: 1,
indent: 0,
endIndent: 0,
),
],
),
);
}
Widget buildPointRowBody() {
bool isEven = widget.rowIndex % 2 == 0;
return Container(
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
color: widget.expandFlag ? Color(0xffe4e4e4) : isEven && !widget.isTableTitle ? Color(0xffefefef) : Colors.white,
child: Column(
children: [
Row(
children: [
Expanded(
child: Container(
child: Texts(
widget.rowTitle,
fontSize: 14,
fontWeight:
widget.isTableTitle ? FontWeight.bold : FontWeight.normal,
),
)),
Expanded(
child: Container(
child: Texts(
widget.isTableTitle ? "POINTS" : "${widget.points}",
fontSize: 14,
fontWeight:
widget.isTableTitle ? FontWeight.bold : FontWeight.normal,
),
)),
Expanded(
child: Container(
child: Texts(
widget.isTableTitle ? "RIYAL" : "${widget.riyal}",
fontSize: 14,
fontWeight:
widget.isTableTitle ? FontWeight.bold : FontWeight.normal,
),
)),
Expanded(
child: widget.isTableTitle
? Container()
: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
widget.collapsed == null
? Icons.keyboard_arrow_right
: widget.expandFlag
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
size: 25,
color: Colors.grey.shade700,
),
],
)),
],
),
],
),
);
}
}