WIP
This commit is contained in:
parent
cbbe2e36f8
commit
784d1d95b8
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||
// import 'package:hub/components/organisms/bottom_arrow_linked_locals/bottom_arrow_linked_locals_component_widget.dart';
|
||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||
import 'package:hub/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart';
|
||||
import 'package:hub/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart';
|
||||
import 'package:hub/custom_code/actions/get_dev_u_u_i_d.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
|
@ -157,8 +158,8 @@ Future singInLoginAction(
|
|||
AppState().serialNumber = await getSerialNumber() ?? '';
|
||||
|
||||
AppState().isLogged = true;
|
||||
AppState().haveLocal =
|
||||
await checkLocals(context: context, model: model);
|
||||
AppState().haveLocal = await checkLocals(context: context, model: model)
|
||||
.then((value) async => await toggleApp(context, value));
|
||||
} else {
|
||||
if (PhpGroup.loginCall.msg((loginCall?.jsonBody ?? '')) == null) {
|
||||
DialogUtil.errorDefault(context);
|
||||
|
@ -395,24 +396,23 @@ Future<bool> checkLocals({
|
|||
return false;
|
||||
}
|
||||
List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||
if (locals != null && locals.isEmpty) {
|
||||
await toggleApp(context, false);
|
||||
|
||||
if (locals.isEmpty) {
|
||||
return false;
|
||||
} else {
|
||||
// else if (locals.where((local) => local['CLU_STATUS'] != 'A').isNotEmpty) {
|
||||
// await showModalBottomSheet(
|
||||
// isScrollControlled: true,
|
||||
// backgroundColor: Colors.transparent,
|
||||
// enableDrag: false,
|
||||
// isDismissible: false,
|
||||
// context: context,
|
||||
// builder: (context) => Padding(
|
||||
// padding: MediaQuery.viewInsetsOf(context),
|
||||
// child: const BottomArrowLinkedLocalsComponentWidget(),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
await toggleApp(context, true);
|
||||
if (locals.where((local) => local['CLU_STATUS'] != 'A').isNotEmpty) {
|
||||
await showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
enableDrag: false,
|
||||
isDismissible: false,
|
||||
context: context,
|
||||
builder: (context) => Padding(
|
||||
padding: MediaQuery.viewInsetsOf(context),
|
||||
child: const BottomArrowLinkedLocalsComponentWidget(),
|
||||
),
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ export 'local_profile_component_model.dart';
|
|||
////
|
||||
|
||||
class LocalProfileComponentWidget extends StatefulWidget {
|
||||
const LocalProfileComponentWidget({required bool localStatus, super.key});
|
||||
const LocalProfileComponentWidget({super.key});
|
||||
|
||||
@override
|
||||
State<LocalProfileComponentWidget> createState() =>
|
||||
|
|
|
@ -7,7 +7,6 @@ import 'package:hub/actions/actions.dart';
|
|||
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||
import 'package:hub/backend/notifications/firebase_messaging_service.dart';
|
||||
import 'package:hub/backend/schema/enums/enums.dart';
|
||||
import 'package:hub/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart';
|
||||
import 'package:hub/components/organism_components/local_profile_component/local_profile_component_widget.dart';
|
||||
import 'package:hub/components/organism_components/menu_component/menu_component_widget.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
||||
|
@ -27,7 +26,6 @@ class HomePageWidget extends StatefulWidget {
|
|||
|
||||
class _HomePageWidgetState extends State<HomePageWidget> {
|
||||
late HomePageModel _model;
|
||||
bool localStatus = false;
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
void checkData() async {
|
||||
|
@ -62,6 +60,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
@ -73,32 +72,30 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
await FirebaseMessagingService().updateDeviceToken();
|
||||
}();
|
||||
|
||||
checkData();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
localStatus = await checkLocals(
|
||||
checkLocals(
|
||||
context: context,
|
||||
model: _model,
|
||||
);
|
||||
).then((_) => checkData());
|
||||
|
||||
if (AppState().cliUUID.isEmpty) {
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
enableDrag: false,
|
||||
isDismissible: false,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Padding(
|
||||
padding: MediaQuery.viewInsetsOf(context),
|
||||
child: const BottomArrowLinkedLocalsComponentWidget(),
|
||||
);
|
||||
},
|
||||
).then((value) => safeSetState(() {}));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
});
|
||||
// WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
// if (AppState().cliUUID.isEmpty) {
|
||||
// showModalBottomSheet(
|
||||
// isScrollControlled: true,
|
||||
// backgroundColor: Colors.transparent,
|
||||
// enableDrag: false,
|
||||
// isDismissible: false,
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return Padding(
|
||||
// padding: MediaQuery.viewInsetsOf(context),
|
||||
// child: const BottomArrowLinkedLocalsComponentWidget(),
|
||||
// );
|
||||
// },
|
||||
// ).then((value) => safeSetState(() {}));
|
||||
// } else {
|
||||
// return;
|
||||
// }
|
||||
// });
|
||||
|
||||
_model.textController ??= TextEditingController();
|
||||
_model.textFieldFocusNode ??= FocusNode();
|
||||
|
@ -125,12 +122,12 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
drawerEnableOpenDragGesture: true,
|
||||
drawerDragStartBehavior: DragStartBehavior.start,
|
||||
drawer: CustomDrawer(model: _model),
|
||||
body: buildPage(context, localStatus),
|
||||
body: buildPage(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Container buildPage(BuildContext context, bool localStatus) {
|
||||
Container buildPage(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
|
@ -151,7 +148,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
createHeader(context),
|
||||
createLocal(localStatus),
|
||||
createLocal(),
|
||||
createBody(),
|
||||
],
|
||||
),
|
||||
|
@ -167,8 +164,8 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height * 0.1,
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFF1AAB5F),
|
||||
),
|
||||
|
@ -320,13 +317,11 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget createLocal(bool localStatus) {
|
||||
Widget createLocal() {
|
||||
return wrapWithModel(
|
||||
model: _model.localComponentModel,
|
||||
updateCallback: () => safeSetState(() {}),
|
||||
child: LocalProfileComponentWidget(
|
||||
localStatus: localStatus,
|
||||
),
|
||||
child: const LocalProfileComponentWidget(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,8 @@ class CustomDrawer extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
return SafeArea(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Drawer(
|
||||
elevation: 16.0,
|
||||
|
@ -28,6 +29,7 @@ class CustomDrawer extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -39,9 +41,9 @@ class CustomDrawer extends StatelessWidget {
|
|||
bottomRight: Radius.circular(5.0),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(30, 30, 10, 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Flexible(
|
||||
fit: FlexFit.loose,
|
||||
|
@ -101,7 +103,6 @@ class CustomDrawer extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue