Skip to content

Commit aa7f6fa

Browse files
authored
Merge pull request #13 from Aastha-Gadhvi/main
Bugs, ToDo 13.3 by Aastha Gadhvi
2 parents 8b3ecff + b99f3fd commit aa7f6fa

19 files changed

+834
-13
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Step 5: Add Guest User/Anonymous login with a Cart and Checkout use case [https:
4242

4343
* delete unlinked anonymous user post logout
4444

45-
Step 6: Add ImagePicker and Firebase Storage for profile image
45+
Step 6: Add ImagePicker and Firebase Storage for profile image (Done)
4646

4747
* Create PopupMenu button for web [https://api.flutter.dev/flutter/material/PopupMenuButton-class.html]
4848
* BottomSheet for phones and single file button for desktops

devtools_options.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
description: This file stores settings for Dart & Flutter DevTools.
2+
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
3+
extensions:

ios/Flutter/Generated.xcconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This is a generated file; do not edit or check into version control.
2+
FLUTTER_ROOT=C:\Users\Aastha Gadhvi\Downloads\flutter_windows_3.10.5-stable\flutter
3+
FLUTTER_APPLICATION_PATH=C:\Users\Aastha Gadhvi\get-flutter-fire
4+
COCOAPODS_PARALLEL_CODE_SIGN=true
5+
FLUTTER_TARGET=lib\main.dart
6+
FLUTTER_BUILD_DIR=build
7+
FLUTTER_BUILD_NAME=1.0.0
8+
FLUTTER_BUILD_NUMBER=1
9+
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386
10+
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7
11+
DART_OBFUSCATION=false
12+
TRACK_WIDGET_CREATION=true
13+
TREE_SHAKE_ICONS=false
14+
PACKAGE_CONFIG=.dart_tool/package_config.json
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
# This is a generated file; do not edit or check into version control.
3+
export "FLUTTER_ROOT=C:\Users\Aastha Gadhvi\Downloads\flutter_windows_3.10.5-stable\flutter"
4+
export "FLUTTER_APPLICATION_PATH=C:\Users\Aastha Gadhvi\get-flutter-fire"
5+
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
6+
export "FLUTTER_TARGET=lib\main.dart"
7+
export "FLUTTER_BUILD_DIR=build"
8+
export "FLUTTER_BUILD_NAME=1.0.0"
9+
export "FLUTTER_BUILD_NUMBER=1"
10+
export "DART_OBFUSCATION=false"
11+
export "TRACK_WIDGET_CREATION=true"
12+
export "TREE_SHAKE_ICONS=false"
13+
export "PACKAGE_CONFIG=.dart_tool/package_config.json"
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
// clang-format off
6+
7+
#ifndef GeneratedPluginRegistrant_h
8+
#define GeneratedPluginRegistrant_h
9+
10+
#import <Flutter/Flutter.h>
11+
12+
NS_ASSUME_NONNULL_BEGIN
13+
14+
@interface GeneratedPluginRegistrant : NSObject
15+
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
16+
@end
17+
18+
NS_ASSUME_NONNULL_END
19+
#endif /* GeneratedPluginRegistrant_h */
+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
// clang-format off
6+
7+
#import "GeneratedPluginRegistrant.h"
8+
9+
#if __has_include(<desktop_webview_auth/DesktopWebviewAuthPlugin.h>)
10+
#import <desktop_webview_auth/DesktopWebviewAuthPlugin.h>
11+
#else
12+
@import desktop_webview_auth;
13+
#endif
14+
15+
#if __has_include(<file_picker/FilePickerPlugin.h>)
16+
#import <file_picker/FilePickerPlugin.h>
17+
#else
18+
@import file_picker;
19+
#endif
20+
21+
#if __has_include(<firebase_analytics/FLTFirebaseAnalyticsPlugin.h>)
22+
#import <firebase_analytics/FLTFirebaseAnalyticsPlugin.h>
23+
#else
24+
@import firebase_analytics;
25+
#endif
26+
27+
#if __has_include(<firebase_auth/FLTFirebaseAuthPlugin.h>)
28+
#import <firebase_auth/FLTFirebaseAuthPlugin.h>
29+
#else
30+
@import firebase_auth;
31+
#endif
32+
33+
#if __has_include(<firebase_core/FLTFirebaseCorePlugin.h>)
34+
#import <firebase_core/FLTFirebaseCorePlugin.h>
35+
#else
36+
@import firebase_core;
37+
#endif
38+
39+
#if __has_include(<firebase_dynamic_links/FLTFirebaseDynamicLinksPlugin.h>)
40+
#import <firebase_dynamic_links/FLTFirebaseDynamicLinksPlugin.h>
41+
#else
42+
@import firebase_dynamic_links;
43+
#endif
44+
45+
#if __has_include(<firebase_remote_config/FLTFirebaseRemoteConfigPlugin.h>)
46+
#import <firebase_remote_config/FLTFirebaseRemoteConfigPlugin.h>
47+
#else
48+
@import firebase_remote_config;
49+
#endif
50+
51+
#if __has_include(<firebase_storage/FLTFirebaseStoragePlugin.h>)
52+
#import <firebase_storage/FLTFirebaseStoragePlugin.h>
53+
#else
54+
@import firebase_storage;
55+
#endif
56+
57+
#if __has_include(<google_sign_in_ios/FLTGoogleSignInPlugin.h>)
58+
#import <google_sign_in_ios/FLTGoogleSignInPlugin.h>
59+
#else
60+
@import google_sign_in_ios;
61+
#endif
62+
63+
#if __has_include(<image_picker_ios/FLTImagePickerPlugin.h>)
64+
#import <image_picker_ios/FLTImagePickerPlugin.h>
65+
#else
66+
@import image_picker_ios;
67+
#endif
68+
69+
#if __has_include(<path_provider_foundation/PathProviderPlugin.h>)
70+
#import <path_provider_foundation/PathProviderPlugin.h>
71+
#else
72+
@import path_provider_foundation;
73+
#endif
74+
75+
@implementation GeneratedPluginRegistrant
76+
77+
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
78+
[DesktopWebviewAuthPlugin registerWithRegistrar:[registry registrarForPlugin:@"DesktopWebviewAuthPlugin"]];
79+
[FilePickerPlugin registerWithRegistrar:[registry registrarForPlugin:@"FilePickerPlugin"]];
80+
[FLTFirebaseAnalyticsPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseAnalyticsPlugin"]];
81+
[FLTFirebaseAuthPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseAuthPlugin"]];
82+
[FLTFirebaseCorePlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseCorePlugin"]];
83+
[FLTFirebaseDynamicLinksPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseDynamicLinksPlugin"]];
84+
[FLTFirebaseRemoteConfigPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseRemoteConfigPlugin"]];
85+
[FLTFirebaseStoragePlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseStoragePlugin"]];
86+
[FLTGoogleSignInPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTGoogleSignInPlugin"]];
87+
[FLTImagePickerPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTImagePickerPlugin"]];
88+
[PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]];
89+
}
90+
91+
@end

lib/app/modules/dashboard/controllers/dashboard_controller.dart

+5
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@ class DashboardController extends GetxController {
1414
},
1515
);
1616
}
17+
var isSearchBarVisible = true.obs;
18+
void toggleSearchBarVisibility() {
19+
isSearchBarVisible.value = !isSearchBarVisible.value;
20+
}
21+
// Observable state for current time (example)
1722
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
1+
// import 'package:flutter/material.dart';
2+
// import 'package:get/get.dart';
3+
//
4+
// import '../controllers/dashboard_controller.dart';
5+
//
6+
// class DashboardView extends GetView<DashboardController> {
7+
// const DashboardView({super.key});
8+
//
9+
// @override
10+
// Widget build(BuildContext context) {
11+
// return Scaffold(
12+
// body: Center(
13+
// child: Obx(
14+
// () => Column(
15+
// mainAxisSize: MainAxisSize.min,
16+
// children: [
17+
// const Text(
18+
// 'DashboardView is working',
19+
// style: TextStyle(fontSize: 20),
20+
// ),
21+
// Text('Time: ${controller.now.value.toString()}'),
22+
// ],
23+
// ),
24+
// ),
25+
// ),
26+
// );
27+
// }
28+
// }
129
import 'package:flutter/material.dart';
230
import 'package:get/get.dart';
31+
import 'package:firebase_remote_config/firebase_remote_config.dart';
332

33+
import '../../../../services/remote_config.dart';
434
import '../controllers/dashboard_controller.dart';
535

636
class DashboardView extends GetView<DashboardController> {
@@ -9,20 +39,105 @@ class DashboardView extends GetView<DashboardController> {
939
@override
1040
Widget build(BuildContext context) {
1141
return Scaffold(
12-
body: Center(
13-
child: Obx(
14-
() => Column(
15-
mainAxisSize: MainAxisSize.min,
16-
children: [
17-
const Text(
18-
'DashboardView is working',
19-
style: TextStyle(fontSize: 20),
20-
),
21-
Text('Time: ${controller.now.value.toString()}'),
22-
],
42+
appBar: AppBar(
43+
title: const Text('Dashboard'),
44+
centerTitle: true,
45+
actions: [
46+
GetBuilder<DashboardController>(
47+
builder: (controller) {
48+
return FutureBuilder<bool>(
49+
future: RemoteConfig.instance.then((config) => config.showSearchBarOnTop()),
50+
builder: (context, snapshot) {
51+
if (snapshot.connectionState == ConnectionState.waiting) {
52+
return const Center(child: CircularProgressIndicator());
53+
} else if (snapshot.hasError || !snapshot.data!) {
54+
return const SizedBox.shrink();
55+
} else {
56+
return GetPlatform.isMobile
57+
? PopupMenuButton<String>(
58+
onSelected: (value) {
59+
if (value == 'toggleSearchBar') {
60+
controller.toggleSearchBarVisibility();
61+
}
62+
},
63+
itemBuilder: (BuildContext context) {
64+
return [
65+
PopupMenuItem<String>(
66+
value: 'toggleSearchBar',
67+
child: Row(
68+
children: [
69+
const Icon(Icons.search),
70+
const SizedBox(width: 8),
71+
const Text('Toggle Search Bar'),
72+
],
73+
),
74+
),
75+
];
76+
},
77+
)
78+
: const SizedBox.shrink();
79+
}
80+
},
81+
);
82+
},
2383
),
84+
],
85+
),
86+
body: Obx(
87+
() {
88+
// Use the controller's state for search bar visibility
89+
bool isSearchBarVisible = controller.isSearchBarVisible.value;
90+
91+
return FutureBuilder<bool>(
92+
future: RemoteConfig.instance.then((config) => config.showSearchBarOnTop()),
93+
builder: (context, snapshot) {
94+
if (snapshot.connectionState == ConnectionState.waiting) {
95+
return const Center(child: CircularProgressIndicator());
96+
} else if (snapshot.hasError) {
97+
return Center(child: Text('Error: ${snapshot.error}'));
98+
} else {
99+
return Column(
100+
mainAxisSize: MainAxisSize.min,
101+
children: [
102+
if (isSearchBarVisible)
103+
Padding(
104+
padding: const EdgeInsets.all(8.0),
105+
child: _buildSearchBar(),
106+
),
107+
Expanded(
108+
child: Center(
109+
child: Column(
110+
mainAxisSize: MainAxisSize.min,
111+
children: [
112+
const Text(
113+
'DashboardView is working',
114+
style: TextStyle(fontSize: 20),
115+
),
116+
Text('Time: ${controller.now.value.toString()}'),
117+
],
118+
),
119+
),
120+
),
121+
],
122+
);
123+
}
124+
},
125+
);
126+
},
127+
),
128+
);
129+
}
130+
131+
Widget _buildSearchBar() {
132+
return TextField(
133+
decoration: InputDecoration(
134+
hintText: 'Search...',
135+
border: OutlineInputBorder(
136+
borderRadius: BorderRadius.circular(10.0),
24137
),
138+
prefixIcon: Icon(Icons.search),
25139
),
26140
);
27141
}
28142
}
143+

lib/app/modules/login/controllers/login_controller.dart

+50-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,59 @@
1+
// // import 'package:get/get.dart';
2+
// //
3+
// // import '../../../../services/auth_service.dart';
4+
// //
5+
// // class LoginController extends GetxController {
6+
// // static AuthService get to => Get.find();
7+
// //
8+
// // final Rx<bool> showReverificationButton = Rx(false);
9+
// //
10+
// // bool get isRobot => AuthService.to.robot.value == true;
11+
// //
12+
// // set robot(bool v) => AuthService.to.robot.value = v;
13+
// //
14+
// // bool get isLoggedIn => AuthService.to.isLoggedInValue;
15+
// //
16+
// // bool get isAnon => AuthService.to.isAnon;
17+
// //
18+
// // bool get isRegistered =>
19+
// // AuthService.to.registered.value || AuthService.to.isEmailVerified;
20+
// // // }
21+
// import 'package:firebase_auth/firebase_auth.dart' as fba;
22+
// import 'package:get/get.dart';
23+
// import '../../../../services/auth_service.dart';
24+
//
25+
// class LoginController extends GetxController {
26+
// static AuthService get to => Get.find();
27+
//
28+
// final Rx<bool> showReverificationButton = Rx(false);
29+
// final Rx<String> verificationId = ''.obs;
30+
// final Rxn<fba.EmailAuthCredential> credential = Rxn<fba.EmailAuthCredential>();
31+
// final Rx<bool> isPhoneVerified = false.obs;
32+
//
33+
// bool get isRobot => AuthService.to.robot.value == true;
34+
//
35+
// set robot(bool v) => AuthService.to.robot.value = v;
36+
//
37+
// bool get isLoggedIn => AuthService.to.isLoggedInValue;
38+
//
39+
// bool get isAnon => AuthService.to.isAnon;
40+
//
41+
// bool get isRegistered => AuthService.to.registered.value || AuthService.to.isEmailVerified;
42+
//
43+
// }
44+
import 'package:firebase_auth/firebase_auth.dart' as fba;
45+
import 'package:firebase_auth/firebase_auth.dart';
146
import 'package:get/get.dart';
2-
347
import '../../../../services/auth_service.dart';
448

549
class LoginController extends GetxController {
650
static AuthService get to => Get.find();
751

852
final Rx<bool> showReverificationButton = Rx(false);
53+
final Rx<String> verificationId = ''.obs;
54+
final Rxn<fba.EmailAuthCredential> credential =
55+
Rxn<fba.EmailAuthCredential>();
56+
final Rx<bool> isPhoneVerified = false.obs; // New observable
957

1058
bool get isRobot => AuthService.to.robot.value == true;
1159

@@ -17,4 +65,5 @@ class LoginController extends GetxController {
1765

1866
bool get isRegistered =>
1967
AuthService.to.registered.value || AuthService.to.isEmailVerified;
68+
2069
}

0 commit comments

Comments
 (0)