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/lib/pages/BookAppointment/Search.dart

122 lines
3.9 KiB
Dart

import 'package:diplomaticquarterapp/analytics/google-analytics.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/components/search_by_hospital_name.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class Search extends StatefulWidget {
final int type;
final List? clnicIds;
Function()? onBackClick;
Search({this.type = 0, this.clnicIds, this.onBackClick});
@override
_SearchState createState() => _SearchState();
}
class _SearchState extends State<Search> with TickerProviderStateMixin {
late TabController _tabController;
@override
void initState() {
_tabController = new TabController(
length: 3,
vsync: this,
initialIndex: widget.type,
);
super.initState();
}
@override
Widget build(BuildContext context) {
AppGlobal.context = context;
// ProjectViewModel projectViewModel = Provider.of(context);
GAnalytics.TREATMENT_TYPE =
null; // reset treatment type on start new booking
return AppScaffold(
isShowAppBar: false,
isShowDecPage: false,
showNewAppBarTitle: true,
showNewAppBar: true,
appBarTitle: TranslationBase.of(context).bookAppo,
backgroundColor: Color(0xFFF7F7F7),
onTap: widget.onBackClick,
body: Column(
children: [
TabBar(
controller: _tabController,
indicatorWeight: 3.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Color(0xff2B353E),
unselectedLabelColor: Color(0xff575757),
labelPadding:
EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
labelStyle: TextStyle(
fontFamily: context.read<ProjectViewModel>().isArabic
? 'Cairo'
: 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
unselectedLabelStyle: TextStyle(
fontFamily: context.read<ProjectViewModel>().isArabic
? 'Cairo'
: 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
tabs: [
Text(
TranslationBase.of(context).hospitalName,
style: TextStyle(fontSize: 12),
),
Text(
TranslationBase.of(context).clinicName,
style: TextStyle(fontSize: 12),
),
Text(
TranslationBase.of(context).doctorName,
style: TextStyle(fontSize: 12),
)
],
onTap: (idx) {
if (idx == 0)
context
.read<ProjectViewModel>()
.analytics
.appointment
.book_appointment_by_clinic();
else
context
.read<ProjectViewModel>()
.analytics
.appointment
.book_appointment_by_doctor();
},
),
Expanded(
child: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
SearchByHospital(),
SearchByClinic(clnicIds: widget.clnicIds),
SearchByDoctor(),
],
controller: _tabController,
),
)
],
),
);
}
}