|
@@ -28,6 +28,17 @@ class MobReqCreatePage extends StatefulWidget {
|
|
|
State<MobReqCreatePage> createState() => _MobReqCreatePageState();
|
|
|
}
|
|
|
|
|
|
+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 _MobReqCreatePageState extends State<MobReqCreatePage> {
|
|
|
final RequestFunction reqFunc = RequestFunction();
|
|
|
final SharedPreferencesManager sharedPreferencesManager = locator<SharedPreferencesManager>();
|
|
@@ -39,6 +50,8 @@ class _MobReqCreatePageState extends State<MobReqCreatePage> {
|
|
|
TextEditingController controllerUserId = new TextEditingController()..text = '';
|
|
|
|
|
|
FocusNode focusNodeLocation = new FocusNode();
|
|
|
+ double _currentSliderValue = 0;
|
|
|
+ Color sliderColor = getColorScheme(0);
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
@@ -51,6 +64,13 @@ class _MobReqCreatePageState extends State<MobReqCreatePage> {
|
|
|
reqFunc.getSuggestionLocation(context);
|
|
|
U.getOtherLabelList(context);
|
|
|
|
|
|
+ switch (widget.request['requestPriority']){
|
|
|
+ case 'RENDAH': _currentSliderValue = 0; break;
|
|
|
+ case 'NORMAL': _currentSliderValue = 50; break;
|
|
|
+ case 'TINGGI': _currentSliderValue = 100; break;
|
|
|
+ }
|
|
|
+ sliderColor = getColorScheme(_currentSliderValue);
|
|
|
+
|
|
|
// TODO: implement initState
|
|
|
super.initState();
|
|
|
}
|
|
@@ -367,7 +387,7 @@ class _MobReqCreatePageState extends State<MobReqCreatePage> {
|
|
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5)), border: Border.all(color: Colors.black26, width: 2)),
|
|
|
),
|
|
|
onTap: ()=>pickupImageNew(),
|
|
|
- ) : Container()
|
|
|
+ ) : Container(),
|
|
|
],
|
|
|
) : GestureDetector(
|
|
|
child: Container(
|
|
@@ -382,7 +402,69 @@ class _MobReqCreatePageState extends State<MobReqCreatePage> {
|
|
|
),
|
|
|
),
|
|
|
onTap: ()=>pickupImageNew(),
|
|
|
- )
|
|
|
+ ),
|
|
|
+ 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()
|
|
|
],
|
|
|
),
|
|
|
],
|
|
@@ -436,7 +518,7 @@ class _MobReqCreatePageState extends State<MobReqCreatePage> {
|
|
|
if (controllerDateString.text.trim().isEmpty && widget.request['noteFormat'] == 'DATE'){
|
|
|
showError(context, 'dateRequired'.tr());
|
|
|
} else {
|
|
|
- reqFunc.sendRequestToOthers(context, widget, controllerUserId, controllerNote, controllerLocation, controllerDateString);
|
|
|
+ reqFunc.sendRequestToOthers(context, widget, controllerUserId, controllerNote, controllerLocation, controllerDateString, _currentSliderValue);
|
|
|
}
|
|
|
} else {
|
|
|
showError(context, 'idRequired'.tr());
|
|
@@ -444,7 +526,7 @@ class _MobReqCreatePageState extends State<MobReqCreatePage> {
|
|
|
} else if (controllerDateString.text.trim().isNotEmpty && widget.request['noteFormat'] == 'DATE'){
|
|
|
dialogSendLater();
|
|
|
} else {
|
|
|
- reqFunc.sendRequest(context, widget, controllerNote, controllerLocation, controllerDateString);
|
|
|
+ reqFunc.sendRequest(context, widget, controllerNote, controllerLocation, controllerDateString, _currentSliderValue);
|
|
|
}
|
|
|
} else {
|
|
|
showError(context, 'lengthMax'.tr());
|
|
@@ -500,7 +582,7 @@ class _MobReqCreatePageState extends State<MobReqCreatePage> {
|
|
|
onTap: (){
|
|
|
navigateBack(contexts);
|
|
|
Provider.of<CreateSerModule>(context, listen: false).setSendLater(true);
|
|
|
- reqFunc.sendRequest(context, widget, controllerNote, controllerLocation, controllerDateString);
|
|
|
+ reqFunc.sendRequest(context, widget, controllerNote, controllerLocation, controllerDateString, _currentSliderValue);
|
|
|
},
|
|
|
),
|
|
|
),
|
|
@@ -529,7 +611,7 @@ class _MobReqCreatePageState extends State<MobReqCreatePage> {
|
|
|
),
|
|
|
onTap: (){
|
|
|
navigateBack(contexts);
|
|
|
- reqFunc.sendRequest(context, widget, controllerNote, controllerLocation, controllerDateString);
|
|
|
+ reqFunc.sendRequest(context, widget, controllerNote, controllerLocation, controllerDateString, _currentSliderValue);
|
|
|
},
|
|
|
),
|
|
|
),
|