Skip to content

Revert "Bugs, ToDo 13.3" #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Step 5: Add Guest User/Anonymous login with a Cart and Checkout use case [https:

* delete unlinked anonymous user post logout

Step 6: Add ImagePicker and Firebase Storage for profile image (Done)
Step 6: Add ImagePicker and Firebase Storage for profile image

* Create PopupMenu button for web [https://api.flutter.dev/flutter/material/PopupMenuButton-class.html]
* BottomSheet for phones and single file button for desktops
Expand Down
3 changes: 0 additions & 3 deletions devtools_options.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions ios/Flutter/Generated.xcconfig

This file was deleted.

13 changes: 0 additions & 13 deletions ios/Flutter/flutter_export_environment.sh

This file was deleted.

19 changes: 0 additions & 19 deletions ios/Runner/GeneratedPluginRegistrant.h

This file was deleted.

91 changes: 0 additions & 91 deletions ios/Runner/GeneratedPluginRegistrant.m

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ class DashboardController extends GetxController {
},
);
}
var isSearchBarVisible = true.obs;
void toggleSearchBarVisibility() {
isSearchBarVisible.value = !isSearchBarVisible.value;
}
// Observable state for current time (example)
}
137 changes: 11 additions & 126 deletions lib/app/modules/dashboard/views/dashboard_view.dart
Original file line number Diff line number Diff line change
@@ -1,36 +1,6 @@
// import 'package:flutter/material.dart';
// import 'package:get/get.dart';
//
// import '../controllers/dashboard_controller.dart';
//
// class DashboardView extends GetView<DashboardController> {
// const DashboardView({super.key});
//
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// body: Center(
// child: Obx(
// () => Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// const Text(
// 'DashboardView is working',
// style: TextStyle(fontSize: 20),
// ),
// Text('Time: ${controller.now.value.toString()}'),
// ],
// ),
// ),
// ),
// );
// }
// }
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:firebase_remote_config/firebase_remote_config.dart';

import '../../../../services/remote_config.dart';
import '../controllers/dashboard_controller.dart';

class DashboardView extends GetView<DashboardController> {
Expand All @@ -39,105 +9,20 @@ class DashboardView extends GetView<DashboardController> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Dashboard'),
centerTitle: true,
actions: [
GetBuilder<DashboardController>(
builder: (controller) {
return FutureBuilder<bool>(
future: RemoteConfig.instance.then((config) => config.showSearchBarOnTop()),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasError || !snapshot.data!) {
return const SizedBox.shrink();
} else {
return GetPlatform.isMobile
? PopupMenuButton<String>(
onSelected: (value) {
if (value == 'toggleSearchBar') {
controller.toggleSearchBarVisibility();
}
},
itemBuilder: (BuildContext context) {
return [
PopupMenuItem<String>(
value: 'toggleSearchBar',
child: Row(
children: [
const Icon(Icons.search),
const SizedBox(width: 8),
const Text('Toggle Search Bar'),
],
),
),
];
},
)
: const SizedBox.shrink();
}
},
);
},
body: Center(
child: Obx(
() => Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
'DashboardView is working',
style: TextStyle(fontSize: 20),
),
Text('Time: ${controller.now.value.toString()}'),
],
),
],
),
body: Obx(
() {
// Use the controller's state for search bar visibility
bool isSearchBarVisible = controller.isSearchBarVisible.value;

return FutureBuilder<bool>(
future: RemoteConfig.instance.then((config) => config.showSearchBarOnTop()),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
if (isSearchBarVisible)
Padding(
padding: const EdgeInsets.all(8.0),
child: _buildSearchBar(),
),
Expanded(
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
'DashboardView is working',
style: TextStyle(fontSize: 20),
),
Text('Time: ${controller.now.value.toString()}'),
],
),
),
),
],
);
}
},
);
},
),
);
}

Widget _buildSearchBar() {
return TextField(
decoration: InputDecoration(
hintText: 'Search...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
),
prefixIcon: Icon(Icons.search),
),
);
}
}

51 changes: 1 addition & 50 deletions lib/app/modules/login/controllers/login_controller.dart
Original file line number Diff line number Diff line change
@@ -1,59 +1,11 @@
// // import 'package:get/get.dart';
// //
// // import '../../../../services/auth_service.dart';
// //
// // class LoginController extends GetxController {
// // static AuthService get to => Get.find();
// //
// // final Rx<bool> showReverificationButton = Rx(false);
// //
// // bool get isRobot => AuthService.to.robot.value == true;
// //
// // set robot(bool v) => AuthService.to.robot.value = v;
// //
// // bool get isLoggedIn => AuthService.to.isLoggedInValue;
// //
// // bool get isAnon => AuthService.to.isAnon;
// //
// // bool get isRegistered =>
// // AuthService.to.registered.value || AuthService.to.isEmailVerified;
// // // }
// import 'package:firebase_auth/firebase_auth.dart' as fba;
// import 'package:get/get.dart';
// import '../../../../services/auth_service.dart';
//
// class LoginController extends GetxController {
// static AuthService get to => Get.find();
//
// final Rx<bool> showReverificationButton = Rx(false);
// final Rx<String> verificationId = ''.obs;
// final Rxn<fba.EmailAuthCredential> credential = Rxn<fba.EmailAuthCredential>();
// final Rx<bool> isPhoneVerified = false.obs;
//
// bool get isRobot => AuthService.to.robot.value == true;
//
// set robot(bool v) => AuthService.to.robot.value = v;
//
// bool get isLoggedIn => AuthService.to.isLoggedInValue;
//
// bool get isAnon => AuthService.to.isAnon;
//
// bool get isRegistered => AuthService.to.registered.value || AuthService.to.isEmailVerified;
//
// }
import 'package:firebase_auth/firebase_auth.dart' as fba;
import 'package:firebase_auth/firebase_auth.dart';
import 'package:get/get.dart';

import '../../../../services/auth_service.dart';

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

final Rx<bool> showReverificationButton = Rx(false);
final Rx<String> verificationId = ''.obs;
final Rxn<fba.EmailAuthCredential> credential =
Rxn<fba.EmailAuthCredential>();
final Rx<bool> isPhoneVerified = false.obs; // New observable

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

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

bool get isRegistered =>
AuthService.to.registered.value || AuthService.to.isEmailVerified;

}
Loading
Loading