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