123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632 |
- import 'package:easy_localization/easy_localization.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_datetime_picker_plus/flutter_datetime_picker_plus.dart';
- import 'package:image_picker/image_picker.dart';
- import 'package:loading_indicator/loading_indicator.dart';
- import 'package:provider/provider.dart';
- import 'package:searchfield/searchfield.dart';
- import 'package:telnow_mobile_new/src/injector/injector.dart';
- import 'package:telnow_mobile_new/src/layouts/functions/request.dart';
- import 'package:telnow_mobile_new/src/layouts/components/template.dart';
- import 'package:telnow_mobile_new/src/storage/sharedpreferences/shared_preferences_manager.dart';
- import 'package:telnow_mobile_new/src/utils/U.dart';
- import 'package:telnow_mobile_new/src/utils/provider.dart';
- import 'package:toggle_switch/toggle_switch.dart';
- class WebReqCreatePage extends StatefulWidget {
- Map<String, dynamic> user;
- Map<String, dynamic> request;
- final bool fromSearch;
- WebReqCreatePage({required this.user, required this.request, this.fromSearch = false, super.key});
- @override
- State<WebReqCreatePage> createState() => _WebReqCreatePageState();
- }
- getColorScheme(val){
- var color;
- switch (val){
- case 0: color = Color(0xFF4FB66C); break;
- case 50: color = Color(0xFFFFA800); break;
- case 100: color = Color(0xFFC9223B); break;
- default: color = Color(0xFF4FB66C);
- }
- return color;
- }
- class _WebReqCreatePageState extends State<WebReqCreatePage> {
- final RequestFunction reqFunc = RequestFunction();
- final SharedPreferencesManager sharedPreferencesManager = locator<SharedPreferencesManager>();
- TextEditingController controllerDate = new TextEditingController()..text = '';
- TextEditingController controllerDateString = new TextEditingController()..text = '';
- TextEditingController controllerNote = new TextEditingController()..text = '';
- TextEditingController controllerLocation = new TextEditingController()..text = '';
- TextEditingController controllerUserId = new TextEditingController()..text = '';
- FocusNode focusNodeLocation = new FocusNode();
- double _currentSliderValue = 0;
- Color sliderColor = getColorScheme(0);
- @override
- void initState() {
- Provider.of<CreateSerModule>(context, listen: false).reset();
- WidgetsBinding.instance.addPostFrameCallback((_) {
- if(widget.request['scanToRequest']) Provider.of<CreateSerModule>(context, listen: false).setLocationType(2);
- Provider.of<CreateSerModule>(context, listen: false).setDefaultLocation(widget.user['_isRelated'] ? sharedPreferencesManager.getString(SharedPreferencesManager.keyScoope) == 'INSIDE' ? widget.user['_2ndLocation'] : widget.user['location'] : widget.user['location']);
- });
- reqFunc.getSuggestionLocation(context);
- U.getOtherLabelList(context);
- // TODO: implement initState
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- final FocusNode inputIdFocusNode = FocusNode();
- return Scaffold(
- backgroundColor: backgroundColor,
- appBar: PreferredSize(preferredSize: Size.fromHeight(0), child: AppBar(elevation: 0, backgroundColor: primaryColor)),
- body: Column(
- children: [
- Container(
- padding: EdgeInsets.symmetric(vertical: 25, horizontal: 100),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(widget.request[U.langColumn(context, 'subject')], style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
- GestureDetector(
- child: Text('buttonBack'.tr(), style: TextStyle(color: primaryColor, fontSize: 14)),
- onTap: ()=>navigateBack(context),
- )
- ],
- ),
- ),
- divider(),
- Expanded(
- child: SingleChildScrollView(
- padding: EdgeInsets.symmetric(vertical: 25, horizontal: 100),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child: Container(
- padding: EdgeInsets.all(20),
- decoration: BoxDecoration(color: Colors.white, border: Border.all(color: textColor.withOpacity(0.15)), borderRadius: BorderRadius.all(Radius.circular(12))),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- children: [
- imageTiles(imageUrl: widget.request['_mobileImage'] ?? "null", width: 110, height: 90),
- SizedBox(width: 20),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(widget.request[U.langColumn(context, '_requestGroupDescription')]??'', style: TextStyle(color: textColor, fontWeight: FontWeight.w600), maxLines: 2, overflow: TextOverflow.ellipsis),
- dashed(),
- Text(widget.request[U.langColumn(context, 'subjectDescription')], style: TextStyle(color: textColor), maxLines: 3, overflow: TextOverflow.ellipsis)
- ],
- ),
- ),
- ],
- ),
- SizedBox(height: 20),
- widget.request['autoResponse'] ? infoContainer('autoResponseText'.tr()) : Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- widget.user['roomAttendant'] ? Container(
- margin: EdgeInsets.only(bottom: 32),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(U.otherLabelList()['main-${context.locale.toString()}']??'someone_else'.tr(), style: TextStyle(color: textColor, fontWeight: FontWeight.w600)),
- SizedBox(height: 12),
- Row(
- children: [
- Container(
- child: ToggleSwitch(
- cornerRadius: 20,
- minWidth: 20,
- minHeight: 20,
- borderWidth: 2,
- activeBgColors: [[Colors.white], [Colors.white]],
- inactiveBgColor: Provider.of<CreateSerModule>(context).others() == 0 ? disabledColor : primaryColor,
- initialLabelIndex: context.watch<CreateSerModule>().others(),
- totalSwitches: 2,
- radiusStyle: true,
- onToggle: (index) {
- if(index == 1) {
- FocusScope.of(context).requestFocus(inputIdFocusNode);
- } else {
- FocusScope.of(context).unfocus();
- }
- context.read<CreateSerModule>().setOthers(index);
- },
- ),
- decoration: BoxDecoration(color: Provider.of<CreateSerModule>(context).others() == 0 ? disabledColor : primaryColor, borderRadius: BorderRadius.all(Radius.circular(20))),
- ),
- SizedBox(width: 8),
- Expanded(child: Text(context.watch<CreateSerModule>().others() == 0 ? 'reqForMySelf'.tr() : 'reqForOthers'.tr(), style: TextStyle(color: textColor, fontSize: 12), maxLines: 2, overflow: TextOverflow.ellipsis))
- ],
- ),
- context.read<CreateSerModule>().others()==1?Container(
- margin: EdgeInsets.only(top: 12),
- width: double.infinity,
- child: TextField(
- controller: controllerUserId,
- focusNode: inputIdFocusNode,
- style: const TextStyle(fontSize: 14, color: Colors.black),
- autofocus: context.read<CreateSerModule>().others() == 1 ? true : false,
- readOnly: false,
- decoration: InputDecoration(
- hintText: U.otherLabelList()['placeholder-${context.locale.toString()}']??'typeId'.tr(),
- hintStyle: TextStyle(color: textColor.withOpacity(0.5), fontSize: 14),
- filled: true,
- fillColor: backgroundColor,
- hoverColor: Colors.black.withOpacity(0.1),
- contentPadding: EdgeInsets.all(13),
- border: InputBorder.none,
- enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: BorderSide(color: Color(0xff262626).withOpacity(0.5))),
- focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: const BorderSide(color: primaryColor)),
- isDense: true
- ),
- ),
- ):Container()
- ],
- ),
- ):Container(),
- widget.request['noteFormat'] == 'DATE' ? Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text("askScheduleTime".tr(), style: TextStyle(color: textColor, fontWeight: FontWeight.w600)),
- SizedBox(height: 8,),
- TextField(
- controller: controllerDate,
- style: TextStyle(fontSize: 14, color: Colors.black),
- readOnly: true,
- decoration: InputDecoration(
- hintText: 'selectDate'.tr(),
- hintStyle: TextStyle(color: textColor.withOpacity(0.5), fontSize: 14),
- filled: true,
- fillColor: backgroundColor,
- hoverColor: Colors.black.withOpacity(0.1),
- contentPadding: EdgeInsets.all(13),
- prefixIcon: Padding(padding: EdgeInsets.only(left: 13, right: 13), child: U.iconsax('calendar-edit', color: textColor, size: 24)),
- border: InputBorder.none,
- enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: BorderSide(color: Color(0xff262626).withOpacity(0.5))),
- focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: const BorderSide(color: primaryColor)),
- isDense: true
- ),
- onTap: () {
- DatePicker.showDateTimePicker(context, showTitleActions: true,
- minTime: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, DateTime.now().hour, DateTime.now().minute),
- onConfirm: (date) {
- try {
- setState(() {
- controllerDate.text = DateFormat('dd MMM yyyy HH:mm:ss', 'id').format(date);
- controllerDateString.text = DateFormat('ddMMyyyy HHmm', 'id').format(date);
- });
- } catch (e) {
- print(e.toString());
- }
- }, currentTime: DateTime.now(), locale: LocaleType.id
- );
- },
- ),
- SizedBox(height: 32,)
- ],) : Container(),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('addImage'.tr(), style: TextStyle(color: textColor, fontWeight: FontWeight.w600)),
- SizedBox(height: 8),
- context.watch<CreateSerModule>().images().length > 0 ? Container(
- width: double.infinity,
- child: LayoutBuilder(
- builder: (context, constraints) {
- var imageWidth = ((constraints.maxWidth-32)/5)-5;
- return Row(
- children: [
- Row(
- children: List.generate(context.watch<CreateSerModule>().images().length, (i){
- return GestureDetector(
- child: Container(
- width: imageWidth, height: imageWidth, alignment: Alignment.topRight,
- margin: EdgeInsets.only(right: i == 4 ? 0 : 6),
- child: Transform.translate(
- offset: Offset(3, -3),
- child: GestureDetector(
- child: Container(
- padding: EdgeInsets.all(3),
- child: Icon(Icons.close_rounded, color: Colors.white, size: 18),
- decoration: BoxDecoration(color: Colors.black54, border: Border.all(color: Colors.white, width: 2), borderRadius: BorderRadius.all(Radius.circular(50))),
- ),
- onTap: ()=>context.read<CreateSerModule>().removeImages(i),
- ),
- ),
- decoration: BoxDecoration(
- color: Colors.black12, borderRadius: BorderRadius.all(Radius.circular(5)), border: Border.all(color: Colors.black26, width: 0.5),
- image: DecorationImage(image: MemoryImage(context.read<CreateSerModule>().images()[i]), fit: BoxFit.cover)
- ),
- ),
- onTap: ()=>navigateTo(context, PhotoPreviewGallery(title: 'image'.tr(), imageList: context.read<CreateSerModule>().images(), startIndex: i, isUrl: false))
- );
- }),
- ),
- context.watch<CreateSerModule>().images().length < 5 ? GestureDetector(
- child: Container(
- width: imageWidth, height: imageWidth, alignment: Alignment.center,
- child: context.watch<CreateSerModule>().setLoadingEffect() ? SizedBox(
- height: 30,
- child: LoadingIndicator(
- indicatorType: Indicator.ballPulseRise,
- colors: U.defaultRainbowColors(),
- strokeWidth: 1,
- backgroundColor: Colors.black.withOpacity(0),
- pathBackgroundColor: Colors.black,
- ),
- ) : Icon(Icons.add_rounded, color: Colors.black26, size: 40),
- decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5)), border: Border.all(color: Colors.black26, width: 2)),
- ),
- onTap: ()=>pickupImageNew(),
- ) : Container(),
- ],
- );
- },
- ),
- ) : GestureDetector(
- child: Container(
- padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
- decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(10)), border: Border.all(color: Color(0xFF078C84)), color: Color(0xFFFFFFFF).withOpacity(0.2)),
- child: Row(
- children: [
- U.iconsax('image', color: primaryColor, size: 30),
- SizedBox(width: 8,),
- Expanded(child: Text('addImageMsg'.tr(), style: TextStyle(color: textColor, fontSize: 12, fontWeight: FontWeight.w300), maxLines: 2, overflow: TextOverflow.ellipsis)),
- ],
- ),
- ),
- onTap: ()=>pickupImageNew(),
- ),
- // Text("MBUH ==> ${U.newServerVersion(1736473802)} X ${U.retServerVersion()}"),
- U.newServerVersion(1736473802) ? Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox(height: 36),
- Text('changePriority'.tr(), style: TextStyle(color: textColor, fontWeight: FontWeight.w600)),
- SizedBox(height: 12),
- Container(
- height: 32,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(25.0),
- border: Border.all(
- width: 3.0,
- color: Colors.transparent,
- ),
- gradient: LinearGradient(
- colors: [
- Color(0xFF4FB66C).withOpacity(1),
- Color(0xFFFFA800).withOpacity(1),
- Color(0xFFC9223B).withOpacity(1),
- ],
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
- ),
- ),
- child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(25.0),
- ),
- child: SliderTheme(
- data: SliderThemeData(
- inactiveTrackColor: Colors.white,
- ),
- child: Slider(
- activeColor: sliderColor,
- value: _currentSliderValue,
- max:100,
- divisions: 2,
- onChanged: (double value) {
- setState(() {
- _currentSliderValue = value;
- sliderColor = getColorScheme(value);
- });
- },
- ),
- ),
- ),
- ),
- SizedBox(height: 4,),
- Center(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('priorityLow'.tr(), style: TextStyle(fontSize: 12),),
- Text('priorityNormal'.tr(), style: TextStyle(fontSize: 12)),
- Text('priorityHigh'.tr(), style: TextStyle(fontSize: 12)),
- ],
- )
- )
- ],
- ) : SizedBox()
- ],
- ),
- ],
- )
- ],
- ),
- ),
- ),
- SizedBox(width:30),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- widget.request['autoResponse'] ? Container() : Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('yourLocation'.tr(), style: TextStyle(color: textColor, fontWeight: FontWeight.w600)),
- !widget.request['scanToRequest'] ? GestureDetector(
- child: Container(
- margin: EdgeInsets.only(top: 8),
- padding: EdgeInsets.symmetric(vertical: 12, horizontal: 15),
- decoration: BoxDecoration(
- color: Provider.of<CreateSerModule>(context).locationType()==1?primaryColor.withOpacity(0.15):Colors.white,
- border: Border.all(color: Provider.of<CreateSerModule>(context).locationType()==1?primaryColor:textColor.withOpacity(0.15)),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12))
- ),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- U.iconsax('location', color: textColor, size: 20),
- SizedBox(width: 15),
- Expanded(child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('defaultLocation'.tr(), style: TextStyle(color: textColor, fontSize: 12, fontWeight: FontWeight.w300)),
- SizedBox(height: 5),
- Text(Provider.of<CreateSerModule>(context).defaultLocation(), style: TextStyle(color: textColor), maxLines: 2, overflow: TextOverflow.ellipsis)
- ],
- ))
- ],
- ),
- ),
- onTap: (){
- if(!widget.request['scanToRequest']) Provider.of<CreateSerModule>(context, listen: false).setLocationType(1);
- },
- ) : Container(),
- GestureDetector(
- child: Container(
- margin: EdgeInsets.only(bottom: 20, top: widget.request['scanToRequest'] ? 8 : 0),
- padding: EdgeInsets.symmetric(vertical: 12, horizontal: 15),
- decoration: BoxDecoration(
- color: context.watch<CreateSerModule>().locationType()==2?primaryColor.withOpacity(0.15):Colors.white,
- border: Border.all(color: context.watch<CreateSerModule>().locationType()==2?primaryColor:textColor.withOpacity(0.15)),
- borderRadius: widget.request['scanToRequest'] ? BorderRadius.all(Radius.circular(12.0)) : BorderRadius.only(bottomLeft: Radius.circular(12), bottomRight: Radius.circular(12))
- ),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- U.iconsax('location', color: Color(0xffD91B1B), size: 20),
- SizedBox(width: 15),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('specifyAnotherLocation'.tr(), style: TextStyle(color: textColor, fontSize: 12, fontWeight: FontWeight.w300)),
- SizedBox(height: 5),
- GestureDetector(
- child: SizedBox(
- width: double.infinity,
- child: SearchField(
- focusNode: focusNodeLocation,
- suggestions: context.watch<CreateSerModule>().suggestion().map((e) => SearchFieldListItem(e, child: Padding(
- padding: EdgeInsets.symmetric(vertical: 5, horizontal: 13),
- child: Text(e, style: TextStyle(fontSize: 14, color: Colors.black)),
- ))).toList(),
- controller: controllerLocation,
- // searchStyle: const TextStyle(fontSize: 14, color: Colors.black),
- enabled: true,
- readOnly: false,
- searchInputDecoration: SearchInputDecoration(
- hintText: 'placeholderLocation'.tr(),
- hintStyle: TextStyle(color: textColor.withOpacity(0.5), fontSize: 14),
- filled: true,
- fillColor: backgroundColor,
- hoverColor: Colors.black.withOpacity(0.1),
- contentPadding: EdgeInsets.all(13),
- border: InputBorder.none,
- disabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: BorderSide(color: Color(0xff262626).withOpacity(0.5))),
- enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: BorderSide(color: Color(0xff262626).withOpacity(0.5))),
- focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: const BorderSide(color: primaryColor)),
- isDense: true
- ),
- maxSuggestionsInViewPort: 3,
- itemHeight: 40,
- ),
- ),
- onTap: ()async{
- context.read<CreateSerModule>().setLocationType(2);
- },
- onTapCancel: () => print("gasido cah"),
- ),
- ],
- ),
- )
- ],
- ),
- ),
- onTap: (){
- context.read<CreateSerModule>().setLocationType(2);
- },
- ),
- ],
- ),
- widget.request['canNotCancel'] ? Padding(
- padding: EdgeInsets.only(top: 15),
- child: infoContainer('canNotCancel1'.tr()),
- ) : Container(),
- SizedBox(height: 10),
- widget.request['autoResponse'] ? Container() : Container(
- margin: EdgeInsets.only(bottom: 10),
- width: double.infinity,
- child: TextField(
- controller: controllerNote,
- style: TextStyle(fontSize: 14, color: Colors.black),
- minLines: 1,
- maxLines: 3,
- keyboardType: widget.request['noteFormat'] == 'NUMBER' ? TextInputType.number : null,
- decoration: InputDecoration(
- hintText: 'placeholderNote'.tr(),
- hintStyle: TextStyle(color: textColor.withOpacity(0.5), fontSize: 14),
- filled: true,
- fillColor: backgroundColor,
- hoverColor: Colors.black.withOpacity(0.1),
- contentPadding: EdgeInsets.all(13),
- prefixIcon: Padding(padding: EdgeInsets.only(left: 13, right: 13), child: U.iconsax('edit-2', color: textColor, size: 24)),
- border: InputBorder.none,
- enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: BorderSide(color: Color(0xff262626).withOpacity(0.5))),
- focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: const BorderSide(color: primaryColor)),
- isDense: true
- ),
- ),
- ),
- buttonTemplate(text: 'buttonSendRequest'.tr(), action: () async{
- if ((Provider.of<CreateSerModule>(context, listen: false).locationType() == 2 && controllerLocation.text.trim().isNotEmpty) || (Provider.of<CreateSerModule>(context, listen: false).locationType() == 1 && Provider.of<CreateSerModule>(context, listen: false).defaultLocation() != '')) {
- if (controllerNote.text.length <= 128) {
- if (widget.user['roomAttendant'] && Provider.of<CreateSerModule>(context, listen: false).others() == 1){
- if (controllerUserId.text.trim().isNotEmpty){
- if (controllerDateString.text.trim().isEmpty && widget.request['noteFormat'] == 'DATE'){
- showError(context, 'dateRequired'.tr());
- } else {
- reqFunc.sendRequestToOthers(context, widget, controllerUserId, controllerNote, controllerLocation, controllerDateString, _currentSliderValue);
- }
- } else {
- showError(context, 'idRequired'.tr());
- }
- } else if (controllerDateString.text.trim().isNotEmpty && widget.request['noteFormat'] == 'DATE'){
- dialogSendLater();
- } else {
- reqFunc.sendRequest(context, widget, controllerNote, controllerLocation, controllerDateString, _currentSliderValue);
- }
- } else {
- showError(context, 'lengthMax'.tr());
- }
- } else {
- showError(context, 'locRequired'.tr());
- }
- })
- ],
- ),
- )
- ],
- ),
- ),
- )
- ],
- ),
- );
- }
- dialogSendLater(){
- showDialog(
- context: context,
- builder: (contexts) => AlertDialog(
- title: Text('sendingOpt'.tr(), style: TextStyle(color: textColor, fontSize: 16, fontWeight: FontWeight.w500)),
- titlePadding: EdgeInsets.all(20),
- contentPadding: EdgeInsets.fromLTRB(20, 4, 20, 28),
- content: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text('sendingOptMsg'.tr(), style: TextStyle(fontSize: 14, color: textColor)),
- SizedBox(height: 12),
- Row(
- children: [
- Expanded(
- child: GestureDetector(
- child: Container(
- padding: EdgeInsets.symmetric(vertical: 20),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- U.iconsax('timer-start', color: Colors.white, size: 30),
- SizedBox(height: 9),
- Text('scheduled'.tr(), style: TextStyle(color: Colors.white, fontSize: 14))
- ],
- ),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(12)),
- gradient: LinearGradient(
- begin: Alignment.topLeft, end: Alignment.bottomRight,
- colors: [
- Color(0xff131480).withOpacity(0.56), Color(0xff131480).withOpacity(0.90), Color(0xff131480).withOpacity(0.75)
- ]
- )
- ),
- ),
- onTap: (){
- navigateBack(contexts);
- Provider.of<CreateSerModule>(context, listen: false).setSendLater(true);
- reqFunc.sendRequest(context, widget, controllerNote, controllerLocation, controllerDateString, _currentSliderValue);
- },
- ),
- ),
- SizedBox(width: 16),
- Expanded(
- child: GestureDetector(
- child: Container(
- padding: EdgeInsets.symmetric(vertical: 20),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- U.iconsax('star-1', color: Colors.white, size: 30),
- SizedBox(height: 9),
- Text('sendNow'.tr(), style: TextStyle(color: Colors.white, fontSize: 14))
- ],
- ),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(12)),
- gradient: LinearGradient(
- begin: Alignment.topLeft, end: Alignment.bottomRight,
- colors: [
- Color(0xff078C84).withOpacity(0.56), Color(0xff078C84).withOpacity(0.90), Color(0xff078C84).withOpacity(0.75)
- ]
- )
- ),
- ),
- onTap: (){
- navigateBack(contexts);
- reqFunc.sendRequest(context, widget, controllerNote, controllerLocation, controllerDateString, _currentSliderValue);
- },
- ),
- ),
- ],
- ),
- SizedBox(height: 12),
- divider(),
- SizedBox(height: 12),
- Container(
- padding: EdgeInsets.all(3),
- child: Text('scheduledMsg'.tr(), style: TextStyle(color: textColor, fontSize: 12, fontWeight: FontWeight.w300)),
- decoration: BoxDecoration(
- color: Color(0xffCCA600).withOpacity(0.2),
- borderRadius: BorderRadius.all(Radius.circular(3))
- ),
- )
- ],
- ),
- ),
- );
- }
- pickupImageNew()async{
- var image = await reqFunc.getImageNew(context, ImageSource.gallery);
- Provider.of<CreateSerModule>(context, listen: false).setImages(image);
- }
- }
|