diff --git a/lib/init/controller/onboarding_controller.dart b/lib/init/controller/onboarding_controller.dart new file mode 100644 index 0000000..a4b7d2f --- /dev/null +++ b/lib/init/controller/onboarding_controller.dart @@ -0,0 +1,5 @@ +import 'package:get/get.dart'; + +class OnboardingController extends GetxController { + +} \ No newline at end of file diff --git a/lib/init/view/onboarding_view.dart b/lib/init/view/onboarding_view.dart index 696be28..c1a0645 100644 --- a/lib/init/view/onboarding_view.dart +++ b/lib/init/view/onboarding_view.dart @@ -1,6 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_norithon_team0/init/view/onboarding_view2.dart'; +import 'package:flutter_norithon_team0/init/controller/onboarding_controller.dart'; import 'package:get/get.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; + +import 'package:flutter_norithon_team0/post/view/add_post_view.dart'; +import 'package:flutter_norithon_team0/post/view/home_view.dart'; class OnboardingView extends StatefulWidget { const OnboardingView({super.key}); @@ -10,6 +15,9 @@ class OnboardingView extends StatefulWidget { } class _OnboardingViewState extends State { + OnboardingController _onboardingController = Get.put(OnboardingController()); + static final storage = FlutterSecureStorage(); + @override Widget build(BuildContext context) { // final controller = Get.put(OnboardingController()); @@ -36,7 +44,6 @@ class _OnboardingViewState extends State { ), InkWell( onTap: () { - Navigator.pop(context); }, child: // ), Image.asset( @@ -46,7 +53,6 @@ class _OnboardingViewState extends State { ), InkWell( onTap: () { - Navigator.pop(context); print("hi"); }, child: // ), @@ -65,8 +71,10 @@ class _OnboardingViewState extends State { width: 20, ), InkWell( - onTap: () { - Navigator.pop(context); + onTap: () async { + await storage.write( + key: "user", value: DateTime.now().toString()); + Get.offAll(() => AddPostView()); }, child: // ), Image.asset( @@ -79,7 +87,7 @@ class _OnboardingViewState extends State { ), InkWell( onTap: () { - Get.to(OnboardingView2()); + Get.to(() => OnboardingView2()); }, child: // ), Image.asset( diff --git a/lib/init/view/onboarding_view2.dart b/lib/init/view/onboarding_view2.dart index d478623..86b51b1 100644 --- a/lib/init/view/onboarding_view2.dart +++ b/lib/init/view/onboarding_view2.dart @@ -1,6 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_norithon_team0/init/view/onboarding_view3.dart'; +import 'package:flutter_norithon_team0/init/controller/onboarding_controller.dart'; import 'package:get/get.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; + +import 'package:flutter_norithon_team0/post/view/add_post_view.dart'; +import 'package:flutter_norithon_team0/post/view/home_view.dart'; class OnboardingView2 extends StatefulWidget { const OnboardingView2({super.key}); @@ -10,6 +15,8 @@ class OnboardingView2 extends StatefulWidget { } class _OnboardingView2State extends State { + static final storage = FlutterSecureStorage(); + @override Widget build(BuildContext context) { // final controller = Get.put(OnboardingController()); @@ -36,7 +43,6 @@ class _OnboardingView2State extends State { ), InkWell( onTap: () { - Navigator.pop(context); }, child: // ), Image.asset( @@ -46,7 +52,6 @@ class _OnboardingView2State extends State { ), InkWell( onTap: () { - Navigator.pop(context); print("hi"); }, child: // ), @@ -65,8 +70,10 @@ class _OnboardingView2State extends State { width: 20, ), InkWell( - onTap: () { - Navigator.pop(context); + onTap: () async { + await storage.write( + key: "user", value: DateTime.now().toString()); + Get.offAll(() => AddPostView()); }, child: // ), Image.asset( diff --git a/lib/init/view/onboarding_view3.dart b/lib/init/view/onboarding_view3.dart index 679711b..08171b0 100644 --- a/lib/init/view/onboarding_view3.dart +++ b/lib/init/view/onboarding_view3.dart @@ -1,5 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:flutter_norithon_team0/init/controller/onboarding_controller.dart'; import 'package:get/get.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; + +import 'package:flutter_norithon_team0/post/view/add_post_view.dart'; +import 'package:flutter_norithon_team0/post/view/home_view.dart'; class OnboardingView3 extends StatefulWidget { const OnboardingView3({super.key}); @@ -9,6 +14,8 @@ class OnboardingView3 extends StatefulWidget { } class _OnboardingView3State extends State { + static final storage = FlutterSecureStorage(); + @override Widget build(BuildContext context) { // final controller = Get.put(OnboardingController()); @@ -35,7 +42,6 @@ class _OnboardingView3State extends State { ), InkWell( onTap: () { - Navigator.pop(context); }, child: // ), Image.asset( @@ -45,7 +51,6 @@ class _OnboardingView3State extends State { ), InkWell( onTap: () { - Navigator.pop(context); print("hi"); }, child: // ), @@ -64,8 +69,9 @@ class _OnboardingView3State extends State { width: 20, ), InkWell( - onTap: () { - Navigator.pop(context); + onTap: () async { + await storage.write(key: "user", value: DateTime.now().toString()); + Get.to(() => AddPostView()); }, child: // ), Image.asset( @@ -77,8 +83,10 @@ class _OnboardingView3State extends State { width: 310, ), InkWell( - onTap: () { - //home으로 감 + onTap: () async { + await storage.write( + key: "user", value: DateTime.now().toString()); + Get.offAll(() => HomeView()); }, child: // ), Image.asset( diff --git a/lib/post/view/detail_view.dart b/lib/post/view/detail_view.dart index 8d4a06a..8791e87 100644 --- a/lib/post/view/detail_view.dart +++ b/lib/post/view/detail_view.dart @@ -19,7 +19,6 @@ class _DetailViewState extends State { void initState() { detailPost = _postController.selectedPost!; super.initState(); - } @override @@ -134,31 +133,52 @@ class _DetailViewState extends State { SizedBox( width: 20, ), - if (!_postController.isNori) - SizedBox( - height: 59, - width: 272, - child: ElevatedButton( - child: const Text( - '오늘의 노리 추가하기 ', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - onPressed: () async { - await _postController - .addNoriPost(detailPost); - Get.back(); - }, - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(16.0), + _postController.isNori + ? SizedBox( + height: 59, + width: 272, + child: ElevatedButton( + child: const Text( + '오늘의 노리 추가됨', + style: TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.bold), + ), + onPressed: () {}, + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(16.0), + ), + primary: Color(0xFFEEEEEE), + ), + ), + ) + : SizedBox( + height: 59, + width: 272, + child: ElevatedButton( + child: const Text( + '오늘의 노리 추가하기 ', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + onPressed: () async { + await _postController + .addNoriPost(detailPost); + Get.back(); + }, + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(16.0), + ), + primary: Color(0xFFFFBA35), + ), ), - primary: Color(0xFFFFBA35), ), - ), - ), ], ) ],