fix the tab bar

merge-requests/623/head
Mohammad Aljammal 4 years ago
parent 27a3dd1eb4
commit 2978aeecb2

@ -1,9 +1,11 @@
import 'dart:ui'; import 'dart:ui';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -14,13 +16,22 @@ class PatientReferralScreen extends StatefulWidget {
_PatientReferralScreen createState() => _PatientReferralScreen(); _PatientReferralScreen createState() => _PatientReferralScreen();
} }
class _PatientReferralScreen extends State<PatientReferralScreen> class _PatientReferralScreen extends State<PatientReferralScreen> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
TabController _tabController; TabController _tabController;
int index=0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_tabController = TabController(length: 2, vsync: this); _tabController = TabController(length: 2, vsync: this);
_tabController.addListener(_handleTabSelection);
}
_handleTabSelection() {
setState(() {
index = _tabController.index;
});
} }
@override @override
@ -29,7 +40,7 @@ class _PatientReferralScreen extends State<PatientReferralScreen>
_tabController.dispose(); _tabController.dispose();
} }
@override
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
@ -39,12 +50,10 @@ class _PatientReferralScreen extends State<PatientReferralScreen>
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
// backgroundColor: Colors.white, // backgroundColor: Colors.white,
appBar: PreferredSize( appBar: PreferredSize(
preferredSize: Size.fromHeight(60.0), preferredSize: Size.fromHeight(MediaQuery.of(context).size.height * 0.070),
child: Center( child: Center(
child: Container( child: Container(
height: 60.0, height: MediaQuery.of(context).size.height * 0.070,
// margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width * 1, // 0.92,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
@ -54,30 +63,71 @@ class _PatientReferralScreen extends State<PatientReferralScreen>
color: Colors.white), color: Colors.white),
child: Center( child: Center(
child: TabBar( child: TabBar(
isScrollable: true, isScrollable: false,
controller: _tabController, controller: _tabController,
indicatorColor: Colors.red[800], indicatorColor: Colors.transparent,
indicatorWeight: 5.0, indicatorWeight: 1.0,
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).primaryColor, labelColor: Theme.of(context).primaryColor,
labelPadding: labelPadding: EdgeInsets.only(top: 0, left:0, right: 0,bottom: 0),
EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0),
unselectedLabelColor: Colors.grey[800], unselectedLabelColor: Colors.grey[800],
tabs: [ tabs: [
Container( Container(
width: MediaQuery.of(context).size.width * 0.30, width: MediaQuery.of(context).size.width * 0.50,
height: MediaQuery.of(context).size.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
Color(0Xffffffff), Color(0xFFCCCCCC),
borderRadius: 4, borderWidth: 0),
child: Center( child: Center(
child: child: Container(
AppText(TranslationBase.of(context).referral), height: MediaQuery.of(context).size.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
index == 0
? Color(0xFFD02127 )
: Color(0xFFEAEAEA),
index == 0 ? Color(0xFFD02127) : Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
child: Center(
child: AppText(
TranslationBase.of(context).myReferredPatient,
fontSize: SizeConfig.textMultiplier * 1.8,
color: index == 0 ? Colors.white : Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
),
),
), ),
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.30, width: MediaQuery.of(context).size.width * 0.50,
height: MediaQuery.of(context).size.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
Color(0Xffffffff), Color(0xFFCCCCCC),
borderRadius: 4, borderWidth: 0),
child: Center( child: Center(
child: AppText( child: Container(
TranslationBase.of(context).myReferredPatient), height: MediaQuery.of(context).size.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
index == 1
? Color(0xFFD02127 )
: Color(0xFFEAEAEA),
index == 1 ? Color(0xFFD02127) : Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
child: Center(
child: AppText(
TranslationBase.of(context).referral,
fontSize: SizeConfig.textMultiplier * 1.8,
color: index == 1 ? Colors.white : Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
),
),
), ),
), ),
], ],
), ),
), ),
@ -91,8 +141,8 @@ class _PatientReferralScreen extends State<PatientReferralScreen>
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
controller: _tabController, controller: _tabController,
children: <Widget>[ children: <Widget>[
MyReferralInPatientScreen(),
ReferredPatientScreen(), ReferredPatientScreen(),
MyReferralInPatientScreen(),
// MyReferredPatient(), // MyReferredPatient(),
], ],
), ),

Loading…
Cancel
Save