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/AlHabibMedicalService/parking_page.dart

211 lines
8.7 KiB
Dart

4 years ago
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/qr_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:maps_launcher/maps_launcher.dart';
import '../../d_q_icons_icons.dart';
4 years ago
class ParkingPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<QrViewModel>(
onModelReady: (model) => model.getIsSaveParking(),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).parking,
body: SingleChildScrollView(
padding: EdgeInsets.all(12),
child: !model.isSavePark
? Column(
children: <Widget>[
Texts(
TranslationBase.of(context).parkingTitle,
fontWeight: FontWeight.normal,
fontSize: 15,
),
SizedBox(
height: 12,
),
Image.asset(
'assets/images/timeline_bg.png',
width: double.infinity,
)
],
)
: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Container(child: Icon(/*Icons.landscape*/DQIcons.parking_icon,size: 130),),
),
4 years ago
SizedBox(
width: 15,
),
Expanded(
child: Container(
height: 150,
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
shape: BoxShape.rectangle),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Texts(model.qrParkingModel.parkingDescriptionN),
Divider(
height: 3,
),
Texts(model.qrParkingModel.rowDescriptionN)
],
),
),
),
],
),
SizedBox(
height: 15,
),
Container(
padding: EdgeInsets.all(8),
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
shape: BoxShape.rectangle),
height: 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(TranslationBase.of(context).showMyPark),
Texts(model.qrParkingModel.floorDescriptionN),
],
),
),
SizedBox(
height: 15,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
shape: BoxShape.rectangle),
padding: EdgeInsets.all(8),
width: double.infinity,
height: 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(TranslationBase.of(context).gate),
Texts(model.qrParkingModel.gateDescriptionN),
],
),
),
SizedBox(
height: 15,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
shape: BoxShape.rectangle),
padding: EdgeInsets.all(8),
width: double.infinity,
height: 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(TranslationBase.of(context).building),
Texts(model.qrParkingModel.buildingDescriptionN),
],
),
),
SizedBox(
height: 15,
),
Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
shape: BoxShape.rectangle),
width: double.infinity,
height: 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(TranslationBase.of(context).branch),
Texts(model.qrParkingModel.branchDescriptionN),
],
),
),
SizedBox(
height: 15,
),
],
),
),
bottomSheet: !model.isSavePark
? Container(
height: MediaQuery.of(context).size.height * 0.10,
width: double.infinity,
child: Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * 0.9,
child: SecondaryButton(
onTap: () async {
model.readQr();
},
label: TranslationBase.of(context).readBarcode,
loading: model.state == ViewState.BusyLocal,
textColor: Theme.of(context).backgroundColor),
),
],
),
)
: Container(
height: MediaQuery.of(context).size.height * 0.15,
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * 0.9,
child: SecondaryButton(
onTap: () async {
MapsLauncher.launchCoordinates(
model.qrParkingModel.latitude,
model.qrParkingModel.longitude,
);
},
disabled: model.qrParkingModel.longitude == 0,
label: TranslationBase.of(context).showMyPark,
textColor: Theme.of(context).backgroundColor),
),
SizedBox(
height: 12,
),
InkWell(
onTap: () => model.clearParking(),
child: Texts(
TranslationBase.of(context).clearMyData,
color: Colors.red,
decoration: TextDecoration.underline,
))
],
),
),
),
);
}
}