Merge branch 'master' of https://git.mokkon.com/tzw/fcs
This commit is contained in:
@@ -26,26 +26,35 @@ class DeliveryAddressRow extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
deliveryAddress.fullName!=""
|
||||
?
|
||||
line(context, deliveryAddress.fullName,
|
||||
iconData: MaterialCommunityIcons.account,
|
||||
color: primaryColor,
|
||||
fontSize: 16),
|
||||
color: Colors.black,
|
||||
fontSize: 16):SizedBox(),
|
||||
deliveryAddress.phoneNumber!=""
|
||||
?
|
||||
line(context, deliveryAddress.phoneNumber,
|
||||
iconData: Icons.phone, color: primaryColor, fontSize: 16),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
iconData: Icons.phone, color: Colors.black, fontSize: 16):SizedBox(),
|
||||
deliveryAddress.addressLine1!=""
|
||||
?
|
||||
line(context, deliveryAddress.addressLine1,
|
||||
iconData: Icons.location_on),
|
||||
iconData: Icons.location_on,color: Colors.black, fontSize: 16):SizedBox(),
|
||||
deliveryAddress.addressLine2!=""
|
||||
?
|
||||
line(
|
||||
context,
|
||||
deliveryAddress.addressLine2,
|
||||
),
|
||||
deliveryAddress.addressLine2,color: Colors.black, fontSize: 16
|
||||
):SizedBox(),
|
||||
deliveryAddress.city!=""
|
||||
?
|
||||
line(
|
||||
context,
|
||||
deliveryAddress.city,
|
||||
),
|
||||
line(context, deliveryAddress.state),
|
||||
deliveryAddress.city,color: Colors.black, fontSize: 16
|
||||
):SizedBox(),
|
||||
deliveryAddress.state!=""
|
||||
?
|
||||
line(context, deliveryAddress.state,color: Colors.black, fontSize: 16):SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/domain/entities/user.dart';
|
||||
import 'package:fcs/helpers/shared_pref.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/transalation.dart';
|
||||
import 'package:fcs/pages/carton/carton_list.dart';
|
||||
import 'package:fcs/pages/chat/message_detail.dart';
|
||||
import 'package:fcs/pages/chat/model/message_model.dart';
|
||||
@@ -27,6 +26,7 @@ import 'package:fcs/pages/pickup/pickup_list.dart';
|
||||
import 'package:fcs/pages/processing/processing_list.dart';
|
||||
import 'package:fcs/pages/rates/shipment_rates.dart';
|
||||
import 'package:fcs/pages/receiving/receiving_list.dart';
|
||||
import 'package:fcs/pages/signin/pinlogin_page.dart';
|
||||
import 'package:fcs/pages/staff/staff_list.dart';
|
||||
import 'package:fcs/pages/widgets/badge.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_widgets.dart';
|
||||
@@ -366,25 +366,7 @@ class _HomePageState extends State<HomePage> {
|
||||
isSelected: isFcs,
|
||||
selectedBorderColor: Colors.white24,
|
||||
);
|
||||
final langToggle = ToggleButtons(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'icons/flags/png/us.png',
|
||||
package: 'country_icons',
|
||||
fit: BoxFit.fitWidth,
|
||||
width: 25,
|
||||
),
|
||||
Image.asset(
|
||||
'icons/flags/png/mm.png',
|
||||
package: 'country_icons',
|
||||
fit: BoxFit.fitWidth,
|
||||
width: 25,
|
||||
)
|
||||
],
|
||||
onPressed: _langChange,
|
||||
isSelected: languageModel.currentState,
|
||||
selectedBorderColor: Colors.white24,
|
||||
);
|
||||
|
||||
final signinBtn = TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
@@ -402,6 +384,14 @@ class _HomePageState extends State<HomePage> {
|
||||
iconSize: 30,
|
||||
icon: Icon(Icons.account_circle,color: buttonColor,),
|
||||
);
|
||||
final pinLoginBtn = IconButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
.push(CupertinoPageRoute(builder: (context) => PinLoginPage()));
|
||||
},
|
||||
iconSize: 30,
|
||||
icon: Icon(SimpleLineIcons.lock,color: buttonColor,),
|
||||
);
|
||||
|
||||
var searchInput = Row(children: [
|
||||
Expanded(
|
||||
@@ -478,17 +468,15 @@ class _HomePageState extends State<HomePage> {
|
||||
actions: login
|
||||
? user.isCustomer()
|
||||
? <Widget>[
|
||||
langToggle,
|
||||
profileBtn,
|
||||
profileBtn,
|
||||
]
|
||||
: <Widget>[
|
||||
fcsToggle,
|
||||
langToggle,
|
||||
pinLoginBtn,
|
||||
profileBtn,
|
||||
]
|
||||
: <Widget>[
|
||||
langToggle,
|
||||
signinBtn,
|
||||
signinBtn,
|
||||
]),
|
||||
body: Container(
|
||||
decoration: BoxDecoration(
|
||||
@@ -518,16 +506,7 @@ class _HomePageState extends State<HomePage> {
|
||||
);
|
||||
}
|
||||
|
||||
_langChange(index) {
|
||||
var languageModel = Provider.of<LanguageModel>(context, listen: false);
|
||||
languageModel.saveLanguage(Translation().supportedLanguages[index]);
|
||||
setState(() {
|
||||
isSelected.asMap().forEach((i, e) {
|
||||
isSelected[i] = false;
|
||||
});
|
||||
isSelected[index] = !isSelected[index];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
_lookup() async {
|
||||
setState(() {
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:fcs/pages/widgets/defalut_delivery_address.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
||||
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -62,9 +63,11 @@ class _ProfileState extends State<Profile> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
MainModel mainModel = Provider.of<MainModel>(context);
|
||||
LanguageModel languageModel = Provider.of<LanguageModel>(context);
|
||||
if (mainModel.user == null) {
|
||||
return Container();
|
||||
}
|
||||
buildLanguage(languageModel);
|
||||
DeliveryAddressModel deliveryAddressModel =
|
||||
Provider.of<DeliveryAddressModel>(context);
|
||||
|
||||
@@ -172,6 +175,12 @@ class _ProfileState extends State<Profile> {
|
||||
builder: (context) => DeliveryAddressList()));
|
||||
},
|
||||
),
|
||||
buildLanguageWidget(
|
||||
context: context,
|
||||
text: "profile.language",
|
||||
iconData: Icons.language,
|
||||
isEng: languageModel.isEng,
|
||||
),
|
||||
getPrivilegeBox(context),
|
||||
SizedBox(height: 15),
|
||||
logoutbutton,
|
||||
@@ -183,6 +192,69 @@ class _ProfileState extends State<Profile> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildLanguageWidget(
|
||||
{required String text,
|
||||
required BuildContext context,
|
||||
IconData? iconData,
|
||||
required bool isEng}) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Icon(iconData, color: primaryColor),
|
||||
const SizedBox(width: 15),
|
||||
Expanded(
|
||||
child: LocalText(
|
||||
context,
|
||||
text,
|
||||
fontSize: 15.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
isEng
|
||||
? Image.asset(
|
||||
'icons/flags/png/us.png',
|
||||
package: 'country_icons',
|
||||
fit: BoxFit.fitWidth,
|
||||
width: 25,
|
||||
)
|
||||
: Image.asset(
|
||||
'icons/flags/png/mm.png',
|
||||
package: 'country_icons',
|
||||
fit: BoxFit.fitWidth,
|
||||
width: 25,
|
||||
),
|
||||
Container(
|
||||
width: 100,
|
||||
padding: const EdgeInsets.only(left: 15),
|
||||
child: DropdownButton(
|
||||
value: selectedLanguage,
|
||||
underline: const SizedBox(),
|
||||
isExpanded: true,
|
||||
items: languagesList
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(
|
||||
value,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
));
|
||||
}).toList(),
|
||||
onChanged: _selectedDropdown)),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_selectedDropdown(selected) {
|
||||
var languageModel = Provider.of<LanguageModel>(context, listen: false);
|
||||
languageModel.saveLanguage(selected);
|
||||
setState(() {
|
||||
selectedLanguage = selected;
|
||||
});
|
||||
}
|
||||
|
||||
Widget getPrivilegeBox(BuildContext context) {
|
||||
User? user = Provider.of<MainModel>(context, listen: false).user;
|
||||
List<Privilege> _privileges =
|
||||
|
||||
127
lib/pages/signin/pinlogin_page.dart
Normal file
127
lib/pages/signin/pinlogin_page.dart
Normal file
@@ -0,0 +1,127 @@
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
||||
import 'package:fcs/pages/widgets/local_button.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pin_input_text_field/pin_input_text_field.dart';
|
||||
|
||||
class PinLoginPage extends StatefulWidget {
|
||||
const PinLoginPage({super.key});
|
||||
|
||||
@override
|
||||
State<PinLoginPage> createState() => _PinLoginPageState();
|
||||
}
|
||||
|
||||
class _PinLoginPageState extends State<PinLoginPage> {
|
||||
bool _isLoading = false;
|
||||
late String pin;
|
||||
late bool allNumberEntered;
|
||||
@override
|
||||
void initState() {
|
||||
pin = "";
|
||||
allNumberEntered = false;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: new Scaffold(
|
||||
appBar: LocalAppBar(
|
||||
backgroundColor: null,
|
||||
arrowColor: Colors.black,
|
||||
),
|
||||
body: _buildLogin(context)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLogin(BuildContext context) {
|
||||
return ListView(
|
||||
padding: EdgeInsets.only(top: 20, left: 15, right: 15, bottom: 20),
|
||||
children: <Widget>[
|
||||
pinLoginLogo,
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 20),
|
||||
child: Center(
|
||||
child: LocalText(
|
||||
context,
|
||||
"welcome.pinlogin",
|
||||
color: Colors.black,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
LocalText(
|
||||
context,
|
||||
"welcome.pinlogin.fcsid",
|
||||
color: Colors.grey,
|
||||
),
|
||||
fcsIdBox,
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 20),
|
||||
child: LocalText(
|
||||
context,
|
||||
"welcome.pinlogin.pin",
|
||||
color: Colors.grey,
|
||||
)),
|
||||
Container(
|
||||
child: PinInputTextField(
|
||||
pinLength: 6,
|
||||
decoration: BoxLooseDecoration(
|
||||
strokeColorBuilder: PinListenColorBuilder(
|
||||
primaryColor, Colors.grey.shade400)),
|
||||
textInputAction: TextInputAction.done,
|
||||
autoFocus: true,
|
||||
onChanged: _pinChange,
|
||||
),
|
||||
),
|
||||
loginBtn,
|
||||
]);
|
||||
}
|
||||
|
||||
final pinLoginLogo = Container(
|
||||
width: 70,
|
||||
height: 70,
|
||||
child: FittedBox(
|
||||
child: Image.asset(
|
||||
"assets/logo.jpg",
|
||||
),
|
||||
fit: BoxFit.fitHeight,
|
||||
),
|
||||
);
|
||||
final fcsIdBox = Column(
|
||||
children: <Widget>[
|
||||
TextFormField(
|
||||
// controller: controller,
|
||||
style: textStyle,
|
||||
cursorColor: primaryColor,
|
||||
keyboardType: TextInputType.text,
|
||||
decoration: new InputDecoration(
|
||||
contentPadding: EdgeInsets.all(0),
|
||||
labelStyle: newLabelStyle(color: Colors.black54, fontSize: 17),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
disabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
final loginBtn = Padding(
|
||||
padding: EdgeInsets.only(top: 30),
|
||||
child: LocalButton(
|
||||
textKey: "welcome.pinlogin",
|
||||
callBack: () {},
|
||||
),
|
||||
);
|
||||
|
||||
_pinChange(pin) {
|
||||
setState(() {
|
||||
this.pin = pin;
|
||||
this.allNumberEntered = this.pin.length == 6;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user