|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/mobile_number.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
@ -13,12 +14,13 @@ class MobileNo extends StatefulWidget {
|
|
|
|
|
final bool disabled;
|
|
|
|
|
|
|
|
|
|
// final String data;
|
|
|
|
|
final List<Countries> countries = [
|
|
|
|
|
new Countries( name: "Saudi Arabia",
|
|
|
|
|
name_ar:"المملكة العربية السعودية", code: '966' ),
|
|
|
|
|
new Countries(name: "United Arab Emirates",
|
|
|
|
|
name_ar:"الإمارات العربية المتحدة", code: '971'),
|
|
|
|
|
];
|
|
|
|
|
// final List<Countries> countries = [
|
|
|
|
|
// new Countries( name: "Saudi Arabia",
|
|
|
|
|
// name_ar:"المملكة العربية السعودية", code: '966' ),
|
|
|
|
|
// new Countries(name: "United Arab Emirates",
|
|
|
|
|
// name_ar:"الإمارات العربية المتحدة", code: '971'),
|
|
|
|
|
// ];
|
|
|
|
|
|
|
|
|
|
final double margin;
|
|
|
|
|
final double marginTop;
|
|
|
|
|
final double marginRight;
|
|
|
|
|
@ -44,9 +46,18 @@ class MobileNo extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _MobileNo extends State<MobileNo> {
|
|
|
|
|
var _selectedType = '966';
|
|
|
|
|
String countryCode = '966';
|
|
|
|
|
var _selectedType = '+966';
|
|
|
|
|
String countryCode = '+966';
|
|
|
|
|
List<Countries> counties = [];
|
|
|
|
|
ProjectViewModel projectProvider;
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
countriesData.forEach((element) {
|
|
|
|
|
this.counties.add(Countries.fromJson(element));
|
|
|
|
|
});
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectProvider = Provider.of(context);
|
|
|
|
|
@ -83,11 +94,13 @@ class _MobileNo extends State<MobileNo> {
|
|
|
|
|
_selectedType = value;
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
items: widget.countries
|
|
|
|
|
.map<DropdownMenuItem<String>>((Countries value) {
|
|
|
|
|
items: counties.map<DropdownMenuItem<String>>(
|
|
|
|
|
(Countries value) {
|
|
|
|
|
return DropdownMenuItem<String>(
|
|
|
|
|
value: value.code,
|
|
|
|
|
child: Text(projectProvider.isArabic == true ? value.name_ar : value.name),
|
|
|
|
|
child: Text(projectProvider.isArabic == true
|
|
|
|
|
? value
|
|
|
|
|
: value.name),
|
|
|
|
|
);
|
|
|
|
|
}).toList())))),
|
|
|
|
|
),
|
|
|
|
|
@ -125,12 +138,17 @@ class _MobileNo extends State<MobileNo> {
|
|
|
|
|
child: TextField(
|
|
|
|
|
controller: widget.controller,
|
|
|
|
|
keyboardType: TextInputType.phone,
|
|
|
|
|
maxLength: 10,
|
|
|
|
|
|
|
|
|
|
// maxLengthEnforced: true,
|
|
|
|
|
// onChanged: (value) {
|
|
|
|
|
// widget.controller.text = countryCode;
|
|
|
|
|
// },
|
|
|
|
|
onChanged: (value) => widget.onNumberChange(value),
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
border: InputBorder.none, hintText: '5xxxxxxxx'),
|
|
|
|
|
counterText: "",
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
hintText: '5xxxxxxxx'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -140,10 +158,10 @@ class _MobileNo extends State<MobileNo> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Countries {
|
|
|
|
|
final String name;
|
|
|
|
|
final String name_ar;
|
|
|
|
|
final String code;
|
|
|
|
|
// class Countries {
|
|
|
|
|
// final String name;
|
|
|
|
|
// final String name_ar;
|
|
|
|
|
// final String code;
|
|
|
|
|
|
|
|
|
|
Countries({this.name, this.name_ar, this.code});
|
|
|
|
|
}
|
|
|
|
|
// Countries({this.name, this.name_ar, this.code});
|
|
|
|
|
// }
|
|
|
|
|
|