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.
doctor_app_flutter/lib/widgets/patients/profile/PatientProfileButton.dart

116 lines
3.5 KiB
Dart

import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart';
import 'package:flutter/material.dart';
class PatientProfileButton extends StatelessWidget {
final String nameLine1;
final String nameLine2;
final String icon;
final dynamic route;
final PatiantInformtion patient;
String from;
String to;
final String url = "assets/images/";
final bool isDisable;
final bool isLoading;
final Function onTap;
PatientProfileButton(
{Key key,
this.patient,
this.nameLine1,
this.nameLine2,
this.icon,
this.route,
this.isDisable = false,
this.onTap,
this.isLoading = false,
this.from,
this.to})
: super(key: key);
@override
Widget build(BuildContext context) {
return new Container(
margin: new EdgeInsets.symmetric(horizontal: 4.0),
child: InkWell(
onTap: isDisable
? null
: onTap != null
? onTap
: () {
navigator(context, this.route);
},
child: Column(children: <Widget>[
Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
this.nameLine1,
color: Color(0xFFB9382C),
fontWeight: FontWeight.w600,
textAlign: TextAlign.left,
fontSize: SizeConfig.textMultiplier * 2,
),
AppText(
this.nameLine2,
color: Colors.black,
fontWeight: FontWeight.w600,
textAlign: TextAlign.left,
fontSize: SizeConfig.textMultiplier * 2,
),
if (isLoading) DrAppCircularProgressIndeicator()
],
),
),
Expanded(
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
padding: EdgeInsets.all(10),
child: new Image.asset(url + icon))
],
)),
)
]),
),
decoration: BoxDecoration(
// border: Border.all(),
color: isDisable ? Colors.grey.withOpacity(0.4) : Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10)),
border: Border.fromBorderSide(BorderSide(
color: Color(0xffBBBBBB),
width: 1,
)),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.2),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow
),
],
),
padding: EdgeInsets.fromLTRB(5, 10, 5, 5),
);
}
void navigator(BuildContext context, route) {
if (from == null) {
from = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd');
}
if (to == null) {
to = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd');
}
Navigator.of(context).pushNamed(route,
arguments: {'patient': patient, 'from': from, 'to': to});
}
}