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/insurance/insurance_update_screen.dart

313 lines
16 KiB
Dart

import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import '../base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart';
class InsuranceUpdate extends StatefulWidget {
@override
_InsuranceUpdateState createState() => _InsuranceUpdateState();
}
class _InsuranceUpdateState extends State<InsuranceUpdate>
with SingleTickerProviderStateMixin {
TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
}
void dispose() {
super.dispose();
_tabController.dispose();
}
//TODO implement update card
Widget build(BuildContext context) {
return BaseView<InsuranceViewModel>(
onModelReady: (model) => model.getInsuranceUpdated(),
builder: (BuildContext context, InsuranceViewModel model, Widget child) =>
AppScaffold(
appBarTitle: TranslationBase.of(context).insurCards,
isShowAppBar: true,
baseViewModel: model,
body: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(70.0),
child: Stack(
children: <Widget>[
Center(
child: Container(
height: 60.0,
margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width * 1.9,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 5.7,
),
),
color: Colors.white,
),
child: Center(
child: TabBar(
controller: _tabController,
isScrollable: true,
indicatorWeight: 4.0,
indicatorColor: Theme.of(context).primaryColor,
labelColor: Theme.of(context).primaryColor,
labelPadding: EdgeInsets.symmetric(
horizontal: 13.0, vertical: 2.0),
unselectedLabelColor: Colors.grey,
tabs: <Widget>[
Container(
width: MediaQuery.of(context).size.width * 0.35,
child: Center(
child: Texts(TranslationBase.of(context)
.updateInsuranceSubtitle),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.35,
child: Center(
child: Texts(TranslationBase.of(context).history),
),
),
],
),
),
),
)
],
),
),
body: Column(
children: <Widget>[
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
Container(
child: model.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList !=
null
? ListView.builder(
itemCount: model.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList.length,
itemBuilder: (BuildContext context, int index) {
return Container(
margin: EdgeInsets.all(10.0),
child: Card(
margin:
EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0),
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(10.0),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
flex: 3,
child: Container(
margin: EdgeInsets.only(
top: 2.0,
left: 10.0,
right: 20.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Texts(
model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.patientName,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
SizedBox(
height: 8,
),
Texts(
TranslationBase.of(context)
.fileno +
": " +
model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.patientID
.toString(),
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
)
],
),
),
),
if (false)
Expanded(
flex: 2,
child: Container(
// height: MediaQuery.of(context).size.height * 0.12,
margin: EdgeInsets.only(top: 2.0),
child: Column(
children: <Widget>[
Container(
child: SecondaryButton(
label: TranslationBase.of(
context)
.updateInsurance,
small: true,
textColor: Colors.white,
// color: Colors.grey,
),
//height: 45,
// width:90
),
],
),
),
)
],
),
),
),
);
})
: Container(),
),
Container(
child: ListView.builder(
itemCount: model.insuranceUpdate == null
? 0
: model.insuranceUpdate.length,
itemBuilder: (BuildContext context, int index) {
return Container(
margin: EdgeInsets.all(10.0),
child: Card(
margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0),
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
flex: 3,
child: Container(
margin: EdgeInsets.only(
top: 2.0,
left: 10.0,
right: 20.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Texts(
model.user.firstName +
" " +
model.user.lastName,
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.black,
),
SizedBox(
height: 8,
),
Texts(
TranslationBase.of(context)
.fileno +
": " +
model
.insuranceUpdate[
index]
.patientID
.toString(),
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.black,
),
SizedBox(
height: 8,
),
Texts(
model.insuranceUpdate[index]
.createdOn,
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.black,
),
],
),
),
),
Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.only(top: 20.0),
child: Column(
children: <Widget>[
Image.asset(
"assets/images/new-design/confirm_button.png",
width: 30.0,
height: 30.0),
Container(
margin: EdgeInsets.only(
top: 13.5, left: 2.0),
child: Texts(
model.insuranceUpdate[index]
.statusDescription,
textAlign: TextAlign.center,
fontSize: 12,
color: Colors.black,
),
),
],
),
),
)
],
),
],
),
),
),
);
}),
),
],
))
],
),
),
),
);
}
}