update logout flow

parent 482cd546
......@@ -9,12 +9,8 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3B8F2F30495DF54C475260F0 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87BA19A8D364DD0686A7FEE2 /* Pods_Runner.framework */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
......@@ -27,8 +23,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -40,7 +34,6 @@
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
33024327C221F515472E9F1F /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
79C89B9F733C7608F23FFD16 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
......@@ -48,7 +41,6 @@
87BA19A8D364DD0686A7FEE2 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
......@@ -62,8 +54,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
3B8F2F30495DF54C475260F0 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -92,9 +82,7 @@
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
......@@ -231,7 +219,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
......
......@@ -15,6 +15,9 @@ import 'ui/edit_profile/edit_profile.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
......@@ -25,10 +28,16 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.blue,
),
home: SplashScreenPage(),
home: SplashScreenPage()
//home: EditProfile(),
);
}
}
......@@ -24,10 +24,14 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
HomePresenter presenter;
@override
void initState() {
void initState(){
presenter = HomePresenter(this);
presenter.Listitem();
presenter.getprofile(widget.id.toString());
// presenter.getid();
presenter.getprofile ();
}
......@@ -231,12 +235,12 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
);
},
child: Container(
child: presenter.getmodel==null?Container():Container(
child: ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(SizeConfig.getWidth(56))),
child: Image.network(
widget.image,
presenter.getmodel.result[0].image ,
fit: BoxFit.contain,
width: SizeConfig.getWidth(30),
height: SizeConfig.getWidth(30),
......
......@@ -7,11 +7,14 @@ import 'package:feelverapp/service/Loading.dart';
import 'package:feelverapp/service/api.dart';
import 'package:feelverapp/service/base_presenter.dart';
import 'package:feelverapp/ui/home/home.dart';
import 'package:feelverapp/util/Accout_util.dart';
import 'package:flutter/material.dart';
import 'package:rflutter_alert/rflutter_alert.dart';
import 'package:shared_preferences/shared_preferences.dart';
class HomePresenter extends BasePresenter<HomePage> {
Api _api;
String uid;
final formkey = GlobalKey<FormState>();
GetprofileModel getmodel;
LoginModel logmodel;
......@@ -28,12 +31,18 @@ class HomePresenter extends BasePresenter<HomePage> {
print('res Fail');
}
}
getprofile(String id) async {
getid() async {
SharedPreferences pref = await SharedPreferences.getInstance();
setState(() {uid =pref.getString('Id');});
return uid;
}
getprofile() async {
_api = Api<GetprofileModel>();
var res = await _api.getprofile({
"id":id.toString()
"id":await AccountUtil.getID()
});
......
......@@ -14,6 +14,7 @@ import 'package:feelverapp/util/Accout_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rflutter_alert/rflutter_alert.dart';
import 'package:shared_preferences/shared_preferences.dart';
......@@ -80,6 +81,12 @@ else {
}
static saveID(String id) async {
SharedPreferences pref = await SharedPreferences.getInstance();
pref.setString('Id', id);
}
letSignIn() async {
LoadingView(state.context).show();
_api = Api<LoginModel>();
......@@ -95,6 +102,9 @@ else {
if (res.fail == null) {
LoginModel model = res.success;
saveID(model.user.customerInfo.id.toString());
print( await AccountUtil.getToken());
Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
......@@ -108,7 +118,7 @@ else {
DialogButton(
color: Color.fromRGBO(106, 179, 170, 1),
onPressed: () { Navigator.pop(state.context);
Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) => HomePage(id:model.user.customerInfo.id.toString(),image: model.user.customerInfo.image,)));} ,
Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) => HomePage(id:model.user.customerInfo.id.toString())));} ,
child: Text(
"ตกลง",
style: TextStyle(color: Colors.white, fontSize: 20),
......
......@@ -10,6 +10,7 @@ import 'package:feelverapp/ui/register/register_email.dart';
import 'package:feelverapp/util/SizeConfig.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
class NavDrawer extends StatefulWidget {
String id;
......@@ -329,11 +330,12 @@ class _NavDrawerState extends State<NavDrawer> with TickerProviderStateMixin {
),
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => LoginPage()),
);
onTap: ()async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.remove('Id');
Navigator.pushReplacement(context,
MaterialPageRoute(builder: (BuildContext ctx) => LoginPage()));
},
child: Container(
padding: EdgeInsets.only(
......
import 'dart:async';
import 'package:feelverapp/ui/home/home.dart';
import 'package:feelverapp/ui/login/login.dart';
import 'package:feelverapp/util/Accout_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
String id;
class SplashScreenPage extends StatefulWidget {
@override
_SplashScreenPageState createState() => _SplashScreenPageState();
}
class _SplashScreenPageState extends State<SplashScreenPage> {
Timer _timer;
@override
void initState() {
_timer = new Timer(Duration(seconds: 2), () => Navigator.pushReplacement(context, CupertinoPageRoute(builder: (_) => LoginPage())));
checklogin();
//print("iddddddd"+id);
_timer = new Timer(Duration(seconds: 2), () => id==null? Navigator.pushReplacement(context, CupertinoPageRoute(builder: (_) => LoginPage())):Navigator.pushReplacement(context, CupertinoPageRoute(builder: (_) => HomePage()))
);
super.initState();
}
checklogin() async {
id = await AccountUtil.getID();
// BackgroundService.initPlatformState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
......
......@@ -14,6 +14,12 @@ class AccountUtil {
return token;
}
static Future<String> getID() async {
SharedPreferences pref = await SharedPreferences.getInstance();
String token =pref.getString('Id');
return token;
}
static signOut() async {
SharedPreferences pref = await SharedPreferences.getInstance();
......
......@@ -7,42 +7,42 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
version: "2.4.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "2.0.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.3"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
version: "1.14.12"
convert:
dependency: transitive
description:
......@@ -56,7 +56,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.1.4"
cupertino_icons:
dependency: "direct main"
description:
......@@ -120,7 +120,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "2.1.12"
image_cropper:
dependency: "direct main"
description:
......@@ -239,7 +239,7 @@ packages:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.1.3"
rflutter_alert:
dependency: "direct main"
description:
......@@ -293,7 +293,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
version: "1.7.0"
stack_trace:
dependency: transitive
description:
......@@ -328,7 +328,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.11"
version: "0.2.15"
typed_data:
dependency: transitive
description:
......@@ -356,7 +356,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
version: "3.6.1"
sdks:
dart: ">=2.6.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment