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(
|
||||||
|
context: context,
|
||||||
|
model: _model,
|
||||||
|
).then((_) => checkData());
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
// WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
localStatus = await checkLocals(
|
// if (AppState().cliUUID.isEmpty) {
|
||||||
context: context,
|
// showModalBottomSheet(
|
||||||
model: _model,
|
// isScrollControlled: true,
|
||||||
);
|
// backgroundColor: Colors.transparent,
|
||||||
|
// enableDrag: false,
|
||||||
if (AppState().cliUUID.isEmpty) {
|
// isDismissible: false,
|
||||||
showModalBottomSheet(
|
// context: context,
|
||||||
isScrollControlled: true,
|
// builder: (context) {
|
||||||
backgroundColor: Colors.transparent,
|
// return Padding(
|
||||||
enableDrag: false,
|
// padding: MediaQuery.viewInsetsOf(context),
|
||||||
isDismissible: false,
|
// child: const BottomArrowLinkedLocalsComponentWidget(),
|
||||||
context: context,
|
// );
|
||||||
builder: (context) {
|
// },
|
||||||
return Padding(
|
// ).then((value) => safeSetState(() {}));
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
// } else {
|
||||||
child: const BottomArrowLinkedLocalsComponentWidget(),
|
// return;
|
||||||
);
|
// }
|
||||||
},
|
// });
|
||||||
).then((value) => safeSetState(() {}));
|
|
||||||
} 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,18 +13,20 @@ class CustomDrawer extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return SafeArea(
|
||||||
width: MediaQuery.of(context).size.width * 0.8,
|
child: SizedBox(
|
||||||
child: Drawer(
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
elevation: 16.0,
|
child: Drawer(
|
||||||
child: Container(
|
elevation: 16.0,
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
child: Container(
|
||||||
child: Column(
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
children: [
|
child: Column(
|
||||||
_buildDrawerHeader(context),
|
children: [
|
||||||
// _buildSearchBar(context),
|
_buildDrawerHeader(context),
|
||||||
_buildDrawerBody(),
|
// _buildSearchBar(context),
|
||||||
].addToStart(const SizedBox(height: 20)),
|
_buildDrawerBody(),
|
||||||
|
].addToStart(const SizedBox(height: 20)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -39,68 +41,67 @@ class CustomDrawer extends StatelessWidget {
|
||||||
bottomRight: Radius.circular(5.0),
|
bottomRight: Radius.circular(5.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Row(
|
||||||
padding: const EdgeInsets.fromLTRB(30, 30, 10, 0),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
child: Row(
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 50.0,
|
width: 50.0,
|
||||||
height: 50.0,
|
height: 50.0,
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
imageUrl: valueOrDefault(
|
imageUrl: valueOrDefault(
|
||||||
'assets/images/person.jpg',
|
'assets/images/person.jpg',
|
||||||
'https://freaccess.com.br/freaccess/Images/Clients/${AppState().cliUUID}.png',
|
'https://freaccess.com.br/freaccess/Images/Clients/${AppState().cliUUID}.png',
|
||||||
),
|
|
||||||
width: 80.0,
|
|
||||||
height: 80.0,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
placeholder: (context, url) =>
|
|
||||||
Image.asset('assets/images/person.jpg'),
|
|
||||||
errorListener: (_) => Image.asset('assets/images/person.jpg'),
|
|
||||||
errorWidget: (_, __, ___) =>
|
|
||||||
Image.asset('assets/images/person.jpg'),
|
|
||||||
),
|
),
|
||||||
|
width: 80.0,
|
||||||
|
height: 80.0,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
placeholder: (context, url) =>
|
||||||
|
Image.asset('assets/images/person.jpg'),
|
||||||
|
errorListener: (_) => Image.asset('assets/images/person.jpg'),
|
||||||
|
errorWidget: (_, __, ___) =>
|
||||||
|
Image.asset('assets/images/person.jpg'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
),
|
||||||
Expanded(
|
SizedBox(width: 10),
|
||||||
child: Column(
|
Expanded(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Text(
|
children: [
|
||||||
convertToUppercase(AppState().name) ?? '',
|
Text(
|
||||||
style: FlutterFlowTheme.of(context).bodyLarge.override(
|
convertToUppercase(AppState().name) ?? '',
|
||||||
fontFamily: 'Nunito Sans',
|
style: FlutterFlowTheme.of(context).bodyLarge.override(
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
fontFamily: 'Nunito Sans',
|
||||||
fontSize: 14.0,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
letterSpacing: 0.0,
|
fontSize: 14.0,
|
||||||
fontWeight: FontWeight.normal,
|
letterSpacing: 0.0,
|
||||||
),
|
fontWeight: FontWeight.normal,
|
||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
),
|
||||||
Text(
|
SizedBox(height: 5),
|
||||||
AppState().email,
|
Text(
|
||||||
style: FlutterFlowTheme.of(context).bodySmall.override(
|
AppState().email,
|
||||||
fontFamily: 'Nunito Sans',
|
style: FlutterFlowTheme.of(context).bodySmall.override(
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
fontFamily: 'Nunito Sans',
|
||||||
fontSize: 12.0,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
letterSpacing: 0.0,
|
fontSize: 12.0,
|
||||||
fontWeight: FontWeight.normal,
|
letterSpacing: 0.0,
|
||||||
),
|
fontWeight: FontWeight.normal,
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue