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_New/lib/presentation/e_referral/new_referral.dart

173 lines
5.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
class NewEReferral extends StatefulWidget {
NewEReferral();
@override
_NewEReferralState createState() => _NewEReferralState();
}
class _NewEReferralState extends State<NewEReferral> with TickerProviderStateMixin {
late PageController _controller;
int _currentIndex = 0;
int pageSelected = 2;
// CreateEReferralRequestModel createEReferralRequestModel = new CreateEReferralRequestModel();
@override
void initState() {
super.initState();
_controller = new PageController();
}
@override
void dispose() {
super.dispose();
}
changePageViewIndex(pageIndex) {
_controller.jumpToPage(pageIndex);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
height: double.infinity,
child: Column(
children: [
Container(
width: double.infinity,
padding: EdgeInsets.only(left: 12,right: 12,top: 12),
child: Row(
children: [
Expanded(
child: showProgress(
title: "Requester Info".needTranslation,
status: _currentIndex == 0
? "InProgress".needTranslation
: _currentIndex > 0
? "Completed".needTranslation
: "Locked".needTranslation,
color: _currentIndex == 0 ? AppColors.infoColor : AppColors.successColor,
),
),
Expanded(
child: showProgress(
title:"Patient Info".needTranslation,
status: _currentIndex == 1
? "InProgress".needTranslation
: _currentIndex > 1
? "Completed".needTranslation
: "Locked".needTranslation,
color: _currentIndex == 1
? AppColors.infoColor
: _currentIndex > 1
? AppColors.successColor
: AppColors.greyColor,
),
),
showProgress(
title: "Other Info".needTranslation,
status: _currentIndex == 2 ? "InProgress".needTranslation :"Locked".needTranslation,
color: _currentIndex == 2
? AppColors.infoColor
: _currentIndex > 3
? AppColors.successColor
: AppColors.greyColor,
isNeedBorder: false,
),
],
),
),
Expanded(
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: _controller,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
scrollDirection: Axis.horizontal,
children: <Widget>[
// NewEReferralStepOnePage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
// NewEReferralStepTowPage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
// NewEReferralStepThreePage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
],
),
),
],
),
),
);
}
Widget showProgress({required String title, required String status, required Color color, bool isNeedBorder = true}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 26,
height: 26,
// decoration: containerRadius(color, 200),
child: Icon(
Icons.done,
color: Colors.white,
size: 16,
),
),
if (isNeedBorder)
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child:Divider(),
)),
],
),
// mHeight(8),
Text(
title,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
letterSpacing: -0.44,
),
),
// mHeight(2),
Container(
padding: EdgeInsets.all(5),
// decoration: containerRadius(color.withOpacity(0.2), 4),
child: Text(
status,
style: TextStyle(
fontSize: 8,
fontWeight: FontWeight.w600,
letterSpacing: -0.32,
color: color,
),
),
),
],
)
],
);
}
}