Merge branch 'login_page' into 'master'
Login page See merge request Cloud_Solution/driver-app!1merge-requests/11/merge
commit
30b2df9b20
@ -0,0 +1,87 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def parse_KV_file(file, separator='=')
|
||||
file_abs_path = File.expand_path(file)
|
||||
if !File.exists? file_abs_path
|
||||
return [];
|
||||
end
|
||||
generated_key_values = {}
|
||||
skip_line_start_symbols = ["#", "/"]
|
||||
File.foreach(file_abs_path) do |line|
|
||||
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
|
||||
plugin = line.split(pattern=separator)
|
||||
if plugin.length == 2
|
||||
podname = plugin[0].strip()
|
||||
path = plugin[1].strip()
|
||||
podpath = File.expand_path("#{path}", file_abs_path)
|
||||
generated_key_values[podname] = podpath
|
||||
else
|
||||
puts "Invalid plugin specification: #{line}"
|
||||
end
|
||||
end
|
||||
generated_key_values
|
||||
end
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
# Flutter Pod
|
||||
|
||||
copied_flutter_dir = File.join(__dir__, 'Flutter')
|
||||
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
|
||||
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
|
||||
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
|
||||
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
|
||||
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
|
||||
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
|
||||
|
||||
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
|
||||
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
|
||||
|
||||
unless File.exist?(copied_framework_path)
|
||||
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
|
||||
end
|
||||
unless File.exist?(copied_podspec_path)
|
||||
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
|
||||
end
|
||||
end
|
||||
|
||||
# Keep pod path relative so it can be checked into Podfile.lock.
|
||||
pod 'Flutter', :path => 'Flutter'
|
||||
|
||||
# Plugin Pods
|
||||
|
||||
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
|
||||
# referring to absolute paths on developers' machines.
|
||||
system('rm -rf .symlinks')
|
||||
system('mkdir -p .symlinks/plugins')
|
||||
plugin_pods = parse_KV_file('../.flutter-plugins')
|
||||
plugin_pods.each do |name, path|
|
||||
symlink = File.join('.symlinks', 'plugins', name)
|
||||
File.symlink(path, symlink)
|
||||
pod name, :path => File.join(symlink, 'ios')
|
||||
end
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
target.build_configurations.each do |config|
|
||||
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "DriverApp",
|
||||
"css_prefix_text": "",
|
||||
"css_use_suffix": false,
|
||||
"hinting": true,
|
||||
"units_per_em": 1000,
|
||||
"ascent": 850,
|
||||
"glyphs": [
|
||||
{
|
||||
"uid": "6b13cdbdada31c1cc88c63aedc146a9c",
|
||||
"css": "logo",
|
||||
"code": 59393,
|
||||
"src": "custom_icons",
|
||||
"selected": true,
|
||||
"svg": {
|
||||
"path": "M1572.1 336.4A308.4 308.4 0 0 0 1008.4 436.3C1007 443.1 1005.5 449.9 1003.6 458.7 972.3 454.4 941.8 450.3 911.4 446.1S850.1 437.4 818 432.8C818.4 426.5 818.3 421 819.2 415.9A498.9 498.9 0 1 1 1532.6 947.1 489.1 489.1 0 0 1 1117.1 960 21.8 21.8 0 0 1 1101 931.9C1116.5 824.5 1160.3 502.5 1164.7 470 1172.6 412.1 1179.8 354 1189 296.4A37.2 37.2 0 0 1 1207.3 272.1 252.3 252.3 0 0 1 1362.2 255.7C1379.3 259 1385.5 264.7 1382.3 283.6 1374.2 331.4 1368.2 379.7 1362.4 427.9 1361.1 438.9 1326.1 693.4 1309.7 810 1331.9 807.6 1351.9 806.7 1371.5 803.2A308.6 308.6 0 0 0 1619 493.2C1618.7 485.7 1616.7 459.2 1615.7 452.9A436.5 436.5 0 0 0 1590.8 372C1588.7 368.6 1577.1 344.3 1572.1 336.4ZM237.6 663.6A308.4 308.4 0 0 0 801.2 563.8C802.7 557 804.2 550.2 806.1 541.4 837.4 545.6 867.9 549.7 898.3 554S959.6 562.7 991.7 567.3C991.3 573.6 991.3 579.1 990.5 584.2A498.9 498.9 0 1 1 277 53 489.1 489.1 0 0 1 692.6 40.1 21.8 21.8 0 0 1 708.6 68.2C693.2 175.5 649.4 497.6 645 530.1 637.1 588 629.9 646 620.7 703.7A37.2 37.2 0 0 1 602.4 728 252.4 252.4 0 0 1 447.5 744.4C430.5 741.1 424.2 735.3 427.4 716.5 435.5 668.6 441.6 620.4 447.3 572.1 448.7 561.2 483.6 306.7 500 190.1 477.8 192.4 457.8 193.4 438.2 196.9A308.6 308.6 0 0 0 190.7 506.9C191 514.3 193 540.9 194.1 547.2A436.5 436.5 0 0 0 218.9 628.1C221 631.4 232.6 655.5 237.6 663.6Z",
|
||||
"width": 1810
|
||||
},
|
||||
"search": [
|
||||
"logo"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/// Flutter icons DriverApp
|
||||
/// Copyright (C) 2020 by original authors @ fluttericon.com, fontello.com
|
||||
/// This font was generated by FlutterIcon.com, which is derived from Fontello.
|
||||
///
|
||||
/// To use this font, place it in your fonts/ directory and include the
|
||||
/// following in your pubspec.yaml
|
||||
///
|
||||
/// flutter:
|
||||
/// fonts:
|
||||
/// - family: DriverApp
|
||||
/// fonts:
|
||||
/// - asset: fonts/DriverApp.ttf
|
||||
///
|
||||
///
|
||||
///
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class DriverApp {
|
||||
DriverApp._();
|
||||
|
||||
static const _kFontFam = 'DriverApp';
|
||||
static const _kFontPkg = null;
|
||||
|
||||
static const IconData logo = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||
}
|
Binary file not shown.
@ -1,3 +1,5 @@
|
||||
const TOKEN = 'token';
|
||||
const APP_LANGUAGE = 'language';
|
||||
const USER_PROFILE = 'user-profile';
|
||||
|
||||
|
||||
|
@ -0,0 +1,64 @@
|
||||
class AuthenticatedUser {
|
||||
int iD;
|
||||
int userID;
|
||||
String password;
|
||||
String userName;
|
||||
int roleID;
|
||||
String name;
|
||||
bool active;
|
||||
String createdOn;
|
||||
int createdBy;
|
||||
Null editedOn;
|
||||
Null editedBy;
|
||||
String mobileNumber;
|
||||
int realRoleID;
|
||||
|
||||
AuthenticatedUser(
|
||||
{this.iD,
|
||||
this.userID,
|
||||
this.password,
|
||||
this.userName,
|
||||
this.roleID,
|
||||
this.name,
|
||||
this.active,
|
||||
this.createdOn,
|
||||
this.createdBy,
|
||||
this.editedOn,
|
||||
this.editedBy,
|
||||
this.mobileNumber,
|
||||
this.realRoleID});
|
||||
|
||||
AuthenticatedUser.fromJson(Map<String, dynamic> json) {
|
||||
iD = json['ID'];
|
||||
userID = json['UserID'];
|
||||
password = json['password'];
|
||||
userName = json['UserName'];
|
||||
roleID = json['RoleID'];
|
||||
name = json['Name'];
|
||||
active = json['Active'];
|
||||
createdOn = json['CreatedOn'];
|
||||
createdBy = json['CreatedBy'];
|
||||
editedOn = json['EditedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
mobileNumber = json['MobileNumber'];
|
||||
realRoleID = json['RealRoleID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ID'] = this.iD;
|
||||
data['UserID'] = this.userID;
|
||||
data['password'] = this.password;
|
||||
data['UserName'] = this.userName;
|
||||
data['RoleID'] = this.roleID;
|
||||
data['Name'] = this.name;
|
||||
data['Active'] = this.active;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['EditedOn'] = this.editedOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['MobileNumber'] = this.mobileNumber;
|
||||
data['RealRoleID'] = this.realRoleID;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
class LoginRequest {
|
||||
int userID;
|
||||
String password;
|
||||
|
||||
LoginRequest({this.userID, this.password});
|
||||
|
||||
LoginRequest.fromJson(Map<String, dynamic> json) {
|
||||
userID = json['UserID'];
|
||||
password = json['Password'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['UserID'] = this.userID;
|
||||
data['Password'] = this.password;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
import 'package:driverapp/config/config.dart';
|
||||
import 'package:driverapp/core/model/authentication/authenticated_user.dart';
|
||||
import 'package:driverapp/core/model/authentication/login_request.dart';
|
||||
import 'package:driverapp/core/service/base_service.dart';
|
||||
|
||||
class AuthenticationService extends BaseService {
|
||||
String selectedClinicName;
|
||||
bool isLogin = false;
|
||||
bool isLoading = true;
|
||||
AuthenticatedUser authenticatedUser;
|
||||
String token;
|
||||
|
||||
AuthenticationService() {
|
||||
// getUserAuthentication();
|
||||
}
|
||||
|
||||
login(LoginRequest loginRequest) async {
|
||||
hasError = false;
|
||||
try {
|
||||
await baseAppClient.post(LOGIN,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
authenticatedUser =
|
||||
AuthenticatedUser.fromJson(response['PatientER_DriverFile']);
|
||||
token = response['LogInTokenID'];
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: loginRequest.toJson());
|
||||
} catch (error) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
import 'package:driverapp/config/shared_pref_kay.dart';
|
||||
import 'package:driverapp/core/enum/viewstate.dart';
|
||||
import 'package:driverapp/core/model/authentication/login_request.dart';
|
||||
import 'package:driverapp/core/service/authentication_service.dart';
|
||||
import 'package:driverapp/core/service/client/base_app_client.dart';
|
||||
import 'package:driverapp/core/viewModels/base_view_model.dart';
|
||||
|
||||
import '../../locator.dart';
|
||||
|
||||
enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED }
|
||||
|
||||
class AuthenticationViewModel extends BaseViewModel {
|
||||
AuthenticationService _authenticationService = locator<AuthenticationService>();
|
||||
|
||||
APP_STATUS get status {
|
||||
if (state == ViewState.Busy || state == ViewState.BusyLocal) {
|
||||
return APP_STATUS.LOADING;
|
||||
} else {
|
||||
if ( user != null) {
|
||||
return APP_STATUS.AUTHENTICATED;
|
||||
} else {
|
||||
return APP_STATUS.UNAUTHENTICATED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AuthenticationViewModel(){
|
||||
sharedPref.clear();
|
||||
}
|
||||
|
||||
login(LoginRequest loginRequest) async {
|
||||
setState(ViewState.BusyLocal);
|
||||
await _authenticationService.login(loginRequest);
|
||||
if (_authenticationService.hasError) {
|
||||
error = _authenticationService.error;
|
||||
setState(ViewState.ErrorLocal);
|
||||
} else {
|
||||
sharedPref.setObject(
|
||||
USER_PROFILE, _authenticationService.authenticatedUser);
|
||||
sharedPref.setString(TOKEN, _authenticationService.token);
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,263 @@
|
||||
import 'package:driverapp/app-icons/driver_app_icons.dart';
|
||||
import 'package:driverapp/core/enum/viewstate.dart';
|
||||
import 'package:driverapp/core/model/authentication/login_request.dart';
|
||||
import 'package:driverapp/core/viewModels/authentication_view_model.dart';
|
||||
import 'package:driverapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:driverapp/pages/base/base_view.dart';
|
||||
import 'package:driverapp/pages/landing/landing_page.dart';
|
||||
import 'package:driverapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:driverapp/uitl/utils.dart';
|
||||
import 'package:driverapp/widgets/buttons/secondary_button.dart';
|
||||
import 'package:driverapp/widgets/data_display/circle-container.dart';
|
||||
import 'package:driverapp/widgets/input/text_field.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
LoginRequest loginRequest = LoginRequest();
|
||||
final loginFormKey = GlobalKey<FormState>();
|
||||
ProjectViewModel projectViewModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
projectViewModel = Provider.of(context);
|
||||
return AnimatedSwitcher(
|
||||
duration: Duration(microseconds: 350),
|
||||
child: BaseView<AuthenticationViewModel>(
|
||||
builder: (_, model, widget) => Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
FractionallySizedBox(
|
||||
widthFactor: 0.80,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 40,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Icon(
|
||||
DriverApp.logo,
|
||||
size: 70,
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
margin: EdgeInsets.only(
|
||||
right: projectViewModel.isArabic
|
||||
? 0
|
||||
: MediaQuery.of(context).size.width * 0.15,
|
||||
left: !projectViewModel.isArabic
|
||||
? 0
|
||||
: MediaQuery.of(context).size.width * 0.15),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"Driver",
|
||||
style: TextStyle(
|
||||
fontSize: 50, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
"Delivery",
|
||||
style: TextStyle(fontSize: 36, letterSpacing: 1),
|
||||
),
|
||||
Text(
|
||||
"APP",
|
||||
style: TextStyle(
|
||||
fontSize: 33,
|
||||
letterSpacing: 33,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
CircleContainer(
|
||||
onTap: () => projectViewModel.changeLanguage('en'),
|
||||
child: Text(
|
||||
TranslationBase.of(context).lanEnglish,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: projectViewModel.isArabic
|
||||
? Colors.black
|
||||
: Colors.white),
|
||||
),
|
||||
color: projectViewModel.isArabic
|
||||
? Colors.transparent
|
||||
: Theme.of(context).primaryColor,
|
||||
borderWidth: projectViewModel.isArabic ? 3 : 0,
|
||||
borderColor: projectViewModel.isArabic
|
||||
? Theme.of(context).primaryColor
|
||||
: Colors.transparent,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
CircleContainer(
|
||||
onTap: () =>
|
||||
projectViewModel.changeLanguage('ar'),
|
||||
child: Text(
|
||||
TranslationBase.of(context).lanArabic,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: !projectViewModel.isArabic
|
||||
? Colors.black
|
||||
: Colors.white),
|
||||
),
|
||||
color: !projectViewModel.isArabic
|
||||
? Colors.transparent
|
||||
: Theme.of(context).primaryColor,
|
||||
borderWidth: !projectViewModel.isArabic ? 3 : 0,
|
||||
borderColor: !projectViewModel.isArabic
|
||||
? Theme.of(context).primaryColor
|
||||
: Colors.transparent),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Form(
|
||||
key: loginFormKey,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
TranslationBase.of(context).enterCredentialsMsg,
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: TextFields(
|
||||
hintText: TranslationBase.of(context).enterId,
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return TranslationBase.of(context)
|
||||
.pleaseEnterYourID;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onSaved: (value) {
|
||||
loginRequest.userID = int.parse(value.trim());
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Container(
|
||||
child: TextFields(
|
||||
borderRadiusValue: 6,
|
||||
hintText:
|
||||
TranslationBase.of(context).enterPassword,
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return TranslationBase.of(context)
|
||||
.pleaseEnterPassword;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onSaved: (value) {
|
||||
loginRequest.password = value;
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
TranslationBase.of(context).forgotPassword,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).primaryColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),Container(
|
||||
margin: EdgeInsets.all(10),
|
||||
height: MediaQuery.of(context).size.height * 0.22,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SecondaryButton(
|
||||
label: TranslationBase.of(context).login,
|
||||
onTap: () {
|
||||
login(model, context);
|
||||
},
|
||||
disabled: model.state == ViewState.BusyLocal,
|
||||
loading: model.state == ViewState.BusyLocal,
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
)
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
login(AuthenticationViewModel model, BuildContext context) async {
|
||||
if (loginFormKey.currentState.validate()) {
|
||||
loginFormKey.currentState.save();
|
||||
await model.login(loginRequest);
|
||||
if (model.state == ViewState.ErrorLocal) {
|
||||
Utils.showErrorToast(model.error);
|
||||
} else {
|
||||
Navigator.push(
|
||||
context, MaterialPageRoute(builder: (context) => LandingPage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
import 'package:driverapp/pages/authentication/login_page.dart';
|
||||
import 'package:driverapp/pages/base/base_view.dart';
|
||||
import 'package:driverapp/pages/landing/landing_page.dart';
|
||||
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'core/viewModels/authentication_view_model.dart';
|
||||
|
||||
class RootPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget buildRoot(APP_STATUS status) {
|
||||
switch (status) {
|
||||
case APP_STATUS.UNAUTHENTICATED:
|
||||
return LoginPage();
|
||||
break;
|
||||
case APP_STATUS.AUTHENTICATED:
|
||||
return LandingPage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return AnimatedSwitcher(
|
||||
duration: Duration(microseconds: 350),
|
||||
child: BaseView<AuthenticationViewModel>(
|
||||
builder: (_, model, widget) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
body: buildRoot((model.status)),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
class CircleContainer extends StatelessWidget {
|
||||
const CircleContainer(
|
||||
{this.child,
|
||||
this.color = Colors.white,
|
||||
this.borderColor,
|
||||
this.borderWidth = 2.0,
|
||||
this.onTap});
|
||||
|
||||
final Widget child;
|
||||
final Color color;
|
||||
final Color borderColor;
|
||||
final double borderWidth;
|
||||
final Function onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
child: Center(child: child),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: color,
|
||||
border: Border.all(
|
||||
color: borderColor ?? Hexcolor("#707070"), width: borderWidth)),
|
||||
height: 60,
|
||||
width: 60,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue