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'; class ParkingPage extends StatelessWidget { @override Widget build(BuildContext context) { return BaseView( 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: [ 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: [ Row( children: [ Expanded( child: Container(child: Icon(/*Icons.landscape*/DQIcons.parking_icon,size: 130),), ), 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: [ 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: [ 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: [ 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: [ 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: [ 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: [ 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: [ 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, )) ], ), ), ), ); } }