first commit
This commit is contained in:
20
lib/components/alert_box_custom_model.dart
Normal file
20
lib/components/alert_box_custom_model.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import 'alert_box_custom_widget.dart' show AlertBoxCustomWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class AlertBoxCustomModel extends FlutterModel<AlertBoxCustomWidget> {
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
20
lib/components/alert_box_custom_o_k_model.dart
Normal file
20
lib/components/alert_box_custom_o_k_model.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import 'alert_box_custom_o_k_widget.dart' show AlertBoxCustomOKWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class AlertBoxCustomOKModel extends FlutterModel<AlertBoxCustomOKWidget> {
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
115
lib/components/alert_box_custom_o_k_widget.dart
Normal file
115
lib/components/alert_box_custom_o_k_widget.dart
Normal file
@@ -0,0 +1,115 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'alert_box_custom_o_k_model.dart';
|
||||
export 'alert_box_custom_o_k_model.dart';
|
||||
|
||||
class AlertBoxCustomOKWidget extends StatefulWidget {
|
||||
const AlertBoxCustomOKWidget({
|
||||
Key? key,
|
||||
this.text,
|
||||
}) : super(key: key);
|
||||
|
||||
final String? text;
|
||||
|
||||
@override
|
||||
_AlertBoxCustomOKWidgetState createState() => _AlertBoxCustomOKWidgetState();
|
||||
}
|
||||
|
||||
class _AlertBoxCustomOKWidgetState extends State<AlertBoxCustomOKWidget> {
|
||||
late AlertBoxCustomOKModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => AlertBoxCustomOKModel());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Container(
|
||||
width: 339.0,
|
||||
height: 192.0,
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterTheme.of(context).secondaryBackground,
|
||||
borderRadius: BorderRadius.circular(40.0),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, 0.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(24.0, 24.0, 24.0, 0.0),
|
||||
child: Text(
|
||||
widget.text!,
|
||||
textAlign: TextAlign.center,
|
||||
style: FlutterTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, 1.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 24.0),
|
||||
child: FFButtonWidget(
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
text: FFLocalizations.of(context).getText(
|
||||
'3jiglf6t' /* OK */,
|
||||
),
|
||||
options: FFButtonOptions(
|
||||
width: 304.0,
|
||||
height: 54.0,
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
||||
iconPadding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||
color: Color(0xFF009B9A),
|
||||
textStyle: FlutterTheme.of(context).titleSmall.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
elevation: 3.0,
|
||||
borderSide: BorderSide(
|
||||
color: Colors.transparent,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(40.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
115
lib/components/alert_box_custom_widget.dart
Normal file
115
lib/components/alert_box_custom_widget.dart
Normal file
@@ -0,0 +1,115 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'alert_box_custom_model.dart';
|
||||
export 'alert_box_custom_model.dart';
|
||||
|
||||
class AlertBoxCustomWidget extends StatefulWidget {
|
||||
const AlertBoxCustomWidget({
|
||||
Key? key,
|
||||
this.text,
|
||||
}) : super(key: key);
|
||||
|
||||
final String? text;
|
||||
|
||||
@override
|
||||
_AlertBoxCustomWidgetState createState() => _AlertBoxCustomWidgetState();
|
||||
}
|
||||
|
||||
class _AlertBoxCustomWidgetState extends State<AlertBoxCustomWidget> {
|
||||
late AlertBoxCustomModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => AlertBoxCustomModel());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Container(
|
||||
width: 339.0,
|
||||
height: 192.0,
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterTheme.of(context).secondaryBackground,
|
||||
borderRadius: BorderRadius.circular(40.0),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, 0.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(24.0, 24.0, 24.0, 0.0),
|
||||
child: Text(
|
||||
widget.text!,
|
||||
textAlign: TextAlign.center,
|
||||
style: FlutterTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, 1.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 24.0),
|
||||
child: FFButtonWidget(
|
||||
onPressed: () async {
|
||||
context.safePop();
|
||||
},
|
||||
text: FFLocalizations.of(context).getText(
|
||||
'4g627wq8' /* Back */,
|
||||
),
|
||||
options: FFButtonOptions(
|
||||
width: 304.0,
|
||||
height: 54.0,
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
||||
iconPadding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||
color: Color(0xFF9B0025),
|
||||
textStyle: FlutterTheme.of(context).titleSmall.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
elevation: 3.0,
|
||||
borderSide: BorderSide(
|
||||
color: Colors.transparent,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(40.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
20
lib/components/alert_box_model.dart
Normal file
20
lib/components/alert_box_model.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import 'alert_box_widget.dart' show AlertBoxWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class AlertBoxModel extends FlutterModel<AlertBoxWidget> {
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
112
lib/components/alert_box_widget.dart
Normal file
112
lib/components/alert_box_widget.dart
Normal file
@@ -0,0 +1,112 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'alert_box_model.dart';
|
||||
export 'alert_box_model.dart';
|
||||
|
||||
class AlertBoxWidget extends StatefulWidget {
|
||||
const AlertBoxWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AlertBoxWidgetState createState() => _AlertBoxWidgetState();
|
||||
}
|
||||
|
||||
class _AlertBoxWidgetState extends State<AlertBoxWidget> {
|
||||
late AlertBoxModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => AlertBoxModel());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Container(
|
||||
width: 339.0,
|
||||
height: 192.0,
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterTheme.of(context).secondaryBackground,
|
||||
borderRadius: BorderRadius.circular(40.0),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, 0.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(24.0, 24.0, 24.0, 0.0),
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'7e2m047k' /* The new password confirmation ... */,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
style: FlutterTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, 1.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 24.0),
|
||||
child: FFButtonWidget(
|
||||
onPressed: () async {
|
||||
context.safePop();
|
||||
},
|
||||
text: FFLocalizations.of(context).getText(
|
||||
'ngpsorqk' /* Back */,
|
||||
),
|
||||
options: FFButtonOptions(
|
||||
width: 304.0,
|
||||
height: 54.0,
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
||||
iconPadding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||
color: Color(0xFF9B0025),
|
||||
textStyle: FlutterTheme.of(context).titleSmall.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
elevation: 3.0,
|
||||
borderSide: BorderSide(
|
||||
color: Colors.transparent,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(40.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
21
lib/components/appbar_model.dart
Normal file
21
lib/components/appbar_model.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'appbar_widget.dart' show AppbarWidget;
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class AppbarModel extends FlutterModel<AppbarWidget> {
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
142
lib/components/appbar_widget.dart
Normal file
142
lib/components/appbar_widget.dart
Normal file
@@ -0,0 +1,142 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'appbar_model.dart';
|
||||
export 'appbar_model.dart';
|
||||
|
||||
class AppbarWidget extends StatefulWidget {
|
||||
const AppbarWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AppbarWidgetState createState() => _AppbarWidgetState();
|
||||
}
|
||||
|
||||
class _AppbarWidgetState extends State<AppbarWidget> {
|
||||
late AppbarModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => AppbarModel());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 105.0,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFFE7E63B), Color(0xFFC6E6D7)],
|
||||
stops: [0.0, 1.0],
|
||||
begin: AlignmentDirectional(0.0, -1.0),
|
||||
end: AlignmentDirectional(0, 1.0),
|
||||
),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(40.0),
|
||||
bottomRight: Radius.circular(40.0),
|
||||
topLeft: Radius.circular(0.0),
|
||||
topRight: Radius.circular(0.0),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 20.0, 0.0, 0.0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1.0, 0.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(20.0, 0.0, 0.0, 0.0),
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () async {
|
||||
Scaffold.of(context).openDrawer();
|
||||
},
|
||||
child: Icon(
|
||||
Icons.density_medium_sharp,
|
||||
color: FlutterTheme.of(context).secondaryText,
|
||||
size: 30.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/numstat+black_1.png',
|
||||
width: 61.0,
|
||||
height: 61.0,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentDirectional(1.0, 0.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 20.0, 0.0),
|
||||
child: badges.Badge(
|
||||
badgeContent: Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'trn1lsym' /* 1 */,
|
||||
),
|
||||
style: FlutterTheme.of(context).titleSmall.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 10.0,
|
||||
),
|
||||
),
|
||||
showBadge: true,
|
||||
shape: badges.BadgeShape.circle,
|
||||
badgeColor: Color(0xFFFF0000),
|
||||
elevation: 4.0,
|
||||
padding: EdgeInsets.all(8.0),
|
||||
position: badges.BadgePosition.topEnd(),
|
||||
animationType: badges.BadgeAnimationType.scale,
|
||||
toAnimate: true,
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () async {
|
||||
context.pushNamed('notification');
|
||||
},
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.bell,
|
||||
color: FlutterTheme.of(context).secondaryText,
|
||||
size: 30.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
27
lib/components/chat_box_model.dart
Normal file
27
lib/components/chat_box_model.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'chat_box_widget.dart' show ChatBoxWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ChatBoxModel extends FlutterModel<ChatBoxWidget> {
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
// State field(s) for MouseRegion widget.
|
||||
bool mouseRegionHovered1 = false;
|
||||
// State field(s) for MouseRegion widget.
|
||||
bool mouseRegionHovered2 = false;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
299
lib/components/chat_box_widget.dart
Normal file
299
lib/components/chat_box_widget.dart
Normal file
@@ -0,0 +1,299 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'chat_box_model.dart';
|
||||
export 'chat_box_model.dart';
|
||||
|
||||
class ChatBoxWidget extends StatefulWidget {
|
||||
const ChatBoxWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ChatBoxWidgetState createState() => _ChatBoxWidgetState();
|
||||
}
|
||||
|
||||
class _ChatBoxWidgetState extends State<ChatBoxWidget> {
|
||||
late ChatBoxModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => ChatBoxModel());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Align(
|
||||
alignment: AlignmentDirectional(0.0, 0.0),
|
||||
child: Stack(
|
||||
alignment: AlignmentDirectional(0.0, 0.0),
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(1.07, 0.5),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 30.0, 0.0),
|
||||
child: Container(
|
||||
width: 71.0,
|
||||
height: 71.0,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFFE7E63B), Color(0xFFC6E6D7)],
|
||||
stops: [0.0, 1.0],
|
||||
begin: AlignmentDirectional(-1.0, 0.0),
|
||||
end: AlignmentDirectional(1.0, 0),
|
||||
),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: MouseRegion(
|
||||
opaque: false,
|
||||
cursor: SystemMouseCursors.click ?? MouseCursor.defer,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/message-2.svg',
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
fit: BoxFit.none,
|
||||
),
|
||||
),
|
||||
onEnter: ((event) async {
|
||||
setState(() => _model.mouseRegionHovered1 = true);
|
||||
setState(() {
|
||||
FFAppState().showChat = true;
|
||||
});
|
||||
}),
|
||||
onExit: ((event) async {
|
||||
setState(() => _model.mouseRegionHovered1 = false);
|
||||
setState(() {
|
||||
FFAppState().showChat = false;
|
||||
});
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (FFAppState().showChat)
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 30.0, 0.0, 0.0),
|
||||
child: Container(
|
||||
width: 335.0,
|
||||
height: 600.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF009B9A),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(0.0),
|
||||
bottomRight: Radius.circular(0.0),
|
||||
topLeft: Radius.circular(40.0),
|
||||
topRight: Radius.circular(40.0),
|
||||
),
|
||||
),
|
||||
child: MouseRegion(
|
||||
opaque: false,
|
||||
cursor: SystemMouseCursors.click ?? MouseCursor.defer,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/whitemessage.svg',
|
||||
width: 61.0,
|
||||
height: 72.0,
|
||||
fit: BoxFit.none,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
10.0, 0.0, 0.0, 0.0),
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'sgf4j0rn' /* How we can help? */,
|
||||
),
|
||||
style: FlutterTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFFEBEBE4),
|
||||
fontSize: 24.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'lbw8sqrb' /* Send us a message and
|
||||
we will... */
|
||||
,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
style: FlutterTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFFEBEBE4),
|
||||
fontSize: 16.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.0, 30.0, 0.0, 0.0),
|
||||
child: Container(
|
||||
width: 300.0,
|
||||
height: 85.0,
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterTheme.of(context)
|
||||
.secondaryBackground,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(0.0),
|
||||
bottomRight: Radius.circular(40.0),
|
||||
topLeft: Radius.circular(40.0),
|
||||
topRight: Radius.circular(0.0),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/bk.svg',
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
fit: BoxFit.none,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'ltzjffri' /* Bookkeeping Service */,
|
||||
),
|
||||
style: FlutterTheme.of(context).bodyMedium,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(1.0, 0.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.0, 0.0, 20.0, 0.0),
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: FlutterTheme.of(context)
|
||||
.secondaryText,
|
||||
size: 16.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.0, 30.0, 0.0, 0.0),
|
||||
child: Container(
|
||||
width: 300.0,
|
||||
height: 85.0,
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterTheme.of(context)
|
||||
.secondaryBackground,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(0.0),
|
||||
bottomRight: Radius.circular(40.0),
|
||||
topLeft: Radius.circular(40.0),
|
||||
topRight: Radius.circular(0.0),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/chat.svg',
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
fit: BoxFit.none,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'amerkqzb' /* Company Secretary
|
||||
Service */
|
||||
,
|
||||
),
|
||||
style: FlutterTheme.of(context).bodyMedium,
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(1.0, 0.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.0, 0.0, 20.0, 0.0),
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: FlutterTheme.of(context)
|
||||
.secondaryText,
|
||||
size: 16.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onEnter: ((event) async {
|
||||
setState(() => _model.mouseRegionHovered2 = true);
|
||||
setState(() {
|
||||
FFAppState().showChat = true;
|
||||
});
|
||||
}),
|
||||
onExit: ((event) async {
|
||||
setState(() => _model.mouseRegionHovered2 = false);
|
||||
setState(() {
|
||||
FFAppState().showChat = false;
|
||||
});
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
25
lib/components/checkbox_model.dart
Normal file
25
lib/components/checkbox_model.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/custom_functions.dart' as functions;
|
||||
import 'checkbox_widget.dart' show CheckboxWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CheckboxModel extends FlutterModel<CheckboxWidget> {
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
// State field(s) for checkbox widget.
|
||||
bool? checkboxValue;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
102
lib/components/checkbox_widget.dart
Normal file
102
lib/components/checkbox_widget.dart
Normal file
@@ -0,0 +1,102 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/custom_functions.dart' as functions;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'checkbox_model.dart';
|
||||
export 'checkbox_model.dart';
|
||||
|
||||
class CheckboxWidget extends StatefulWidget {
|
||||
const CheckboxWidget({
|
||||
Key? key,
|
||||
this.permissionList,
|
||||
this.getPermissions,
|
||||
}) : super(key: key);
|
||||
|
||||
final dynamic permissionList;
|
||||
final List<int>? getPermissions;
|
||||
|
||||
@override
|
||||
_CheckboxWidgetState createState() => _CheckboxWidgetState();
|
||||
}
|
||||
|
||||
class _CheckboxWidgetState extends State<CheckboxWidget> {
|
||||
late CheckboxModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => CheckboxModel());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Theme(
|
||||
data: ThemeData(
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
visualDensity: VisualDensity.standard,
|
||||
materialTapTargetSize: MaterialTapTargetSize.padded,
|
||||
),
|
||||
unselectedWidgetColor: FlutterTheme.of(context).secondaryText,
|
||||
),
|
||||
child: CheckboxListTile(
|
||||
value: _model.checkboxValue ??= functions.comparePermission(
|
||||
widget.getPermissions!.toList(),
|
||||
getJsonField(
|
||||
widget.permissionList,
|
||||
r'''$.id''',
|
||||
)),
|
||||
onChanged: (newValue) async {
|
||||
setState(() => _model.checkboxValue = newValue!);
|
||||
if (newValue!) {
|
||||
FFAppState().update(() {
|
||||
FFAppState().addToAddPermissionsID(getJsonField(
|
||||
widget.permissionList,
|
||||
r'''$.id''',
|
||||
).toString());
|
||||
});
|
||||
} else {
|
||||
FFAppState().update(() {
|
||||
FFAppState().addToRemovePermissionsID(getJsonField(
|
||||
widget.permissionList,
|
||||
r'''$.id''',
|
||||
).toString());
|
||||
});
|
||||
}
|
||||
},
|
||||
title: Text(
|
||||
getJsonField(
|
||||
widget.permissionList,
|
||||
r'''$.display_name''',
|
||||
).toString(),
|
||||
style: FlutterTheme.of(context).titleLarge.override(
|
||||
fontFamily: 'Outfit',
|
||||
fontSize: 16.0,
|
||||
),
|
||||
),
|
||||
tileColor: Colors.black,
|
||||
activeColor: Colors.white,
|
||||
checkColor: Colors.black,
|
||||
dense: false,
|
||||
controlAffinity: ListTileControlAffinity.trailing,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
33
lib/components/date_model.dart
Normal file
33
lib/components/date_model.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import '/flutterlib/flutter_icon_button.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/custom_functions.dart' as functions;
|
||||
import 'date_widget.dart' show DateWidget;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class DateModel extends FlutterModel<DateWidget> {
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
// State field(s) for date widget.
|
||||
FocusNode? dateFocusNode;
|
||||
TextEditingController? dateController;
|
||||
String? Function(BuildContext, String?)? dateControllerValidator;
|
||||
DateTime? datePicked;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {
|
||||
dateFocusNode?.dispose();
|
||||
dateController?.dispose();
|
||||
}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
154
lib/components/date_widget.dart
Normal file
154
lib/components/date_widget.dart
Normal file
@@ -0,0 +1,154 @@
|
||||
import '/flutterlib/flutter_icon_button.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/custom_functions.dart' as functions;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'date_model.dart';
|
||||
export 'date_model.dart';
|
||||
|
||||
class DateWidget extends StatefulWidget {
|
||||
const DateWidget({
|
||||
Key? key,
|
||||
this.companyMembers,
|
||||
}) : super(key: key);
|
||||
|
||||
final dynamic companyMembers;
|
||||
|
||||
@override
|
||||
_DateWidgetState createState() => _DateWidgetState();
|
||||
}
|
||||
|
||||
class _DateWidgetState extends State<DateWidget> {
|
||||
late DateModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => DateModel());
|
||||
|
||||
_model.dateController ??= TextEditingController();
|
||||
_model.dateFocusNode ??= FocusNode();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0),
|
||||
child: Container(
|
||||
width: 326.0,
|
||||
child: TextFormField(
|
||||
controller: _model.dateController,
|
||||
focusNode: _model.dateFocusNode,
|
||||
textCapitalization: TextCapitalization.none,
|
||||
readOnly: true,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
hintText: FFLocalizations.of(context).getText(
|
||||
'q97i0ohq' /* YYYY/MM/DD */,
|
||||
),
|
||||
hintStyle: FlutterTheme.of(context).labelMedium,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0xFF6D7581),
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(23.8),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterTheme.of(context).primary,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(23.8),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterTheme.of(context).error,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(23.8),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterTheme.of(context).error,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(23.8),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
),
|
||||
style: FlutterTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 16.0,
|
||||
),
|
||||
keyboardType: TextInputType.datetime,
|
||||
validator: _model.dateControllerValidator.asValidator(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 8.0, 0.0),
|
||||
child: FlutterIconButton(
|
||||
borderColor: FlutterTheme.of(context).primaryText,
|
||||
borderRadius: 20.0,
|
||||
borderWidth: 1.0,
|
||||
buttonSize: 40.0,
|
||||
fillColor: FlutterTheme.of(context).secondaryBackground,
|
||||
icon: Icon(
|
||||
Icons.calendar_month,
|
||||
color: FlutterTheme.of(context).primaryText,
|
||||
size: 24.0,
|
||||
),
|
||||
onPressed: () async {
|
||||
final _datePickedDate = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: getCurrentTimestamp,
|
||||
firstDate: DateTime(1900),
|
||||
lastDate: getCurrentTimestamp,
|
||||
);
|
||||
|
||||
if (_datePickedDate != null) {
|
||||
safeSetState(() {
|
||||
_model.datePicked = DateTime(
|
||||
_datePickedDate.year,
|
||||
_datePickedDate.month,
|
||||
_datePickedDate.day,
|
||||
);
|
||||
});
|
||||
}
|
||||
setState(() {
|
||||
_model.dateController?.text =
|
||||
functions.formatDate(_model.datePicked!.toString());
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
20
lib/components/emptylist_model.dart
Normal file
20
lib/components/emptylist_model.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'emptylist_widget.dart' show EmptylistWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class EmptylistModel extends FlutterModel<EmptylistWidget> {
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
54
lib/components/emptylist_widget.dart
Normal file
54
lib/components/emptylist_widget.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'emptylist_model.dart';
|
||||
export 'emptylist_model.dart';
|
||||
|
||||
class EmptylistWidget extends StatefulWidget {
|
||||
const EmptylistWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_EmptylistWidgetState createState() => _EmptylistWidgetState();
|
||||
}
|
||||
|
||||
class _EmptylistWidgetState extends State<EmptylistWidget> {
|
||||
late EmptylistModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => EmptylistModel());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/Empty_List_Icon.svg',
|
||||
width: 358.0,
|
||||
height: 277.0,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
21
lib/components/nav_bar1_model.dart
Normal file
21
lib/components/nav_bar1_model.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import '/flutterlib/flutter_icon_button.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'nav_bar1_widget.dart' show NavBar1Widget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class NavBar1Model extends FlutterModel<NavBar1Widget> {
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
217
lib/components/nav_bar1_widget.dart
Normal file
217
lib/components/nav_bar1_widget.dart
Normal file
@@ -0,0 +1,217 @@
|
||||
import '/flutterlib/flutter_icon_button.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'nav_bar1_model.dart';
|
||||
export 'nav_bar1_model.dart';
|
||||
|
||||
class NavBar1Widget extends StatefulWidget {
|
||||
const NavBar1Widget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NavBar1WidgetState createState() => _NavBar1WidgetState();
|
||||
}
|
||||
|
||||
class _NavBar1WidgetState extends State<NavBar1Widget> {
|
||||
late NavBar1Model _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => NavBar1Model());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 90.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0x00EEEEEE),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
elevation: 0.0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(0.0),
|
||||
bottomRight: Radius.circular(0.0),
|
||||
topLeft: Radius.circular(20.0),
|
||||
topRight: Radius.circular(20.0),
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 80.0,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 10.0,
|
||||
color: Color(0x1A57636C),
|
||||
offset: Offset(0.0, -10.0),
|
||||
spreadRadius: 0.1,
|
||||
)
|
||||
],
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFF7DB979), Color(0xFF26BBAA)],
|
||||
stops: [0.0, 1.0],
|
||||
begin: AlignmentDirectional(-1.0, 0.0),
|
||||
end: AlignmentDirectional(1.0, 0),
|
||||
),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(0.0),
|
||||
bottomRight: Radius.circular(0.0),
|
||||
topLeft: Radius.circular(20.0),
|
||||
topRight: Radius.circular(20.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () async {
|
||||
setState(() {
|
||||
FFAppState().memberID = 0;
|
||||
});
|
||||
|
||||
context.pushNamed('dashboard');
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/doc.svg',
|
||||
width: 44.0,
|
||||
height: 44.0,
|
||||
fit: BoxFit.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () async {
|
||||
context.pushNamed('user');
|
||||
|
||||
setState(() {
|
||||
FFAppState().deleteAddPermissionsID();
|
||||
FFAppState().addPermissionsID = [];
|
||||
});
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/Group_3.svg',
|
||||
width: 44.0,
|
||||
height: 44.0,
|
||||
fit: BoxFit.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 3.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 3.0),
|
||||
child: FlutterIconButton(
|
||||
borderColor: Colors.transparent,
|
||||
borderRadius: 53.0,
|
||||
borderWidth: 1.0,
|
||||
buttonSize: 60.0,
|
||||
fillColor: Color(0xFFF3CF5D),
|
||||
icon: Icon(
|
||||
Icons.home_outlined,
|
||||
color: Colors.white,
|
||||
size: 30.0,
|
||||
),
|
||||
onPressed: () async {
|
||||
context.pushNamed('menu');
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () async {
|
||||
context.pushNamed('bk3');
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/Group.svg',
|
||||
width: 44.0,
|
||||
height: 44.0,
|
||||
fit: BoxFit.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () async {
|
||||
context.pushNamed('compsec');
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/noun-secretary-3915985.svg',
|
||||
width: 44.0,
|
||||
height: 44.0,
|
||||
fit: BoxFit.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
241
lib/components/new_member_model.dart
Normal file
241
lib/components/new_member_model.dart
Normal file
@@ -0,0 +1,241 @@
|
||||
import '/backend/api_requests/api_calls.dart';
|
||||
import '/components/alert_box_custom_widget.dart';
|
||||
import '/flutterlib/flutter_drop_down.dart';
|
||||
import '/flutterlib/flutter_icon_button.dart';
|
||||
import '/flutterlib/flutter_radio_button.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import '/flutterlib/form_field_controller.dart';
|
||||
import '/flutterlib/upload_data.dart';
|
||||
import '/flutterlib/custom_functions.dart' as functions;
|
||||
import 'new_member_widget.dart' show NewMemberWidget;
|
||||
import 'package:aligned_dialog/aligned_dialog.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class NewMemberModel extends FlutterModel<NewMemberWidget> {
|
||||
/// Local state fields for this component.
|
||||
|
||||
dynamic companyID;
|
||||
|
||||
bool uploadPhoto = false;
|
||||
|
||||
bool reuploadPhoto = false;
|
||||
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
final formKey = GlobalKey<FormState>();
|
||||
// State field(s) for position widget.
|
||||
FormFieldController<String>? positionValueController;
|
||||
// State field(s) for title widget.
|
||||
String? titleValue;
|
||||
FormFieldController<String>? titleValueController;
|
||||
// State field(s) for name_english widget.
|
||||
FocusNode? nameEnglishFocusNode;
|
||||
TextEditingController? nameEnglishController;
|
||||
String? Function(BuildContext, String?)? nameEnglishControllerValidator;
|
||||
String? _nameEnglishControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
's47kindu' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for name_chinese widget.
|
||||
FocusNode? nameChineseFocusNode;
|
||||
TextEditingController? nameChineseController;
|
||||
String? Function(BuildContext, String?)? nameChineseControllerValidator;
|
||||
String? _nameChineseControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'zaflur71' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for phone widget.
|
||||
FocusNode? phoneFocusNode;
|
||||
TextEditingController? phoneController;
|
||||
String? Function(BuildContext, String?)? phoneControllerValidator;
|
||||
String? _phoneControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'7vcgack8' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for email widget.
|
||||
FocusNode? emailFocusNode;
|
||||
TextEditingController? emailController;
|
||||
String? Function(BuildContext, String?)? emailControllerValidator;
|
||||
String? _emailControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'w81fu2lr' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
if (!RegExp(kTextValidatorEmailRegex).hasMatch(val)) {
|
||||
return 'Has to be a valid email address.';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for date widget.
|
||||
FocusNode? dateFocusNode;
|
||||
TextEditingController? dateController;
|
||||
String? Function(BuildContext, String?)? dateControllerValidator;
|
||||
String? _dateControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'7yetp4yv' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
DateTime? datePicked;
|
||||
// State field(s) for documentType widget.
|
||||
String? documentTypeValue;
|
||||
FormFieldController<String>? documentTypeValueController;
|
||||
// State field(s) for documentNo widget.
|
||||
FocusNode? documentNoFocusNode;
|
||||
TextEditingController? documentNoController;
|
||||
String? Function(BuildContext, String?)? documentNoControllerValidator;
|
||||
String? _documentNoControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'r6lv0t4k' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for country widget.
|
||||
FocusNode? countryFocusNode;
|
||||
TextEditingController? countryController;
|
||||
String? Function(BuildContext, String?)? countryControllerValidator;
|
||||
String? _countryControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'qv9aw44u' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for city widget.
|
||||
FocusNode? cityFocusNode;
|
||||
TextEditingController? cityController;
|
||||
String? Function(BuildContext, String?)? cityControllerValidator;
|
||||
// State field(s) for addressEn widget.
|
||||
FocusNode? addressEnFocusNode;
|
||||
TextEditingController? addressEnController;
|
||||
String? Function(BuildContext, String?)? addressEnControllerValidator;
|
||||
String? _addressEnControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'i6hy2l1b' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for addressCn widget.
|
||||
FocusNode? addressCnFocusNode;
|
||||
TextEditingController? addressCnController;
|
||||
String? Function(BuildContext, String?)? addressCnControllerValidator;
|
||||
String? _addressCnControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'mualn9yy' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
bool isDataUploading1 = false;
|
||||
FFUploadedFile uploadedLocalFile1 =
|
||||
FFUploadedFile(bytes: Uint8List.fromList([]));
|
||||
|
||||
bool isDataUploading2 = false;
|
||||
FFUploadedFile uploadedLocalFile2 =
|
||||
FFUploadedFile(bytes: Uint8List.fromList([]));
|
||||
|
||||
// Stores action output result for [Backend Call - API (Save or Update Member)] action in Button widget.
|
||||
ApiCallResponse? saveMember;
|
||||
// Stores action output result for [Backend Call - API (Save or Update Member)] action in Button widget.
|
||||
ApiCallResponse? saveMember1;
|
||||
// Stores action output result for [Backend Call - API (Save or Update Member)] action in Button widget.
|
||||
ApiCallResponse? saveMember2;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {
|
||||
nameEnglishControllerValidator = _nameEnglishControllerValidator;
|
||||
nameChineseControllerValidator = _nameChineseControllerValidator;
|
||||
phoneControllerValidator = _phoneControllerValidator;
|
||||
emailControllerValidator = _emailControllerValidator;
|
||||
dateControllerValidator = _dateControllerValidator;
|
||||
documentNoControllerValidator = _documentNoControllerValidator;
|
||||
countryControllerValidator = _countryControllerValidator;
|
||||
addressEnControllerValidator = _addressEnControllerValidator;
|
||||
addressCnControllerValidator = _addressCnControllerValidator;
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
nameEnglishFocusNode?.dispose();
|
||||
nameEnglishController?.dispose();
|
||||
|
||||
nameChineseFocusNode?.dispose();
|
||||
nameChineseController?.dispose();
|
||||
|
||||
phoneFocusNode?.dispose();
|
||||
phoneController?.dispose();
|
||||
|
||||
emailFocusNode?.dispose();
|
||||
emailController?.dispose();
|
||||
|
||||
dateFocusNode?.dispose();
|
||||
dateController?.dispose();
|
||||
|
||||
documentNoFocusNode?.dispose();
|
||||
documentNoController?.dispose();
|
||||
|
||||
countryFocusNode?.dispose();
|
||||
countryController?.dispose();
|
||||
|
||||
cityFocusNode?.dispose();
|
||||
cityController?.dispose();
|
||||
|
||||
addressEnFocusNode?.dispose();
|
||||
addressEnController?.dispose();
|
||||
|
||||
addressCnFocusNode?.dispose();
|
||||
addressCnController?.dispose();
|
||||
}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
|
||||
String? get positionValue => positionValueController?.value;
|
||||
}
|
||||
1751
lib/components/new_member_widget.dart
Normal file
1751
lib/components/new_member_widget.dart
Normal file
File diff suppressed because it is too large
Load Diff
20
lib/components/no_permission_model.dart
Normal file
20
lib/components/no_permission_model.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'no_permission_widget.dart' show NoPermissionWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class NoPermissionModel extends FlutterModel<NoPermissionWidget> {
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
90
lib/components/no_permission_widget.dart
Normal file
90
lib/components/no_permission_widget.dart
Normal file
@@ -0,0 +1,90 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'no_permission_model.dart';
|
||||
export 'no_permission_model.dart';
|
||||
|
||||
class NoPermissionWidget extends StatefulWidget {
|
||||
const NoPermissionWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NoPermissionWidgetState createState() => _NoPermissionWidgetState();
|
||||
}
|
||||
|
||||
class _NoPermissionWidgetState extends State<NoPermissionWidget> {
|
||||
late NoPermissionModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => NoPermissionModel());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 20.0, 0.0, 20.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterTheme.of(context).alternate,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/pp.svg',
|
||||
width: 200.0,
|
||||
height: 200.0,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, -1.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 5.0, 0.0, 0.0),
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'b9fp2z8u' /* Your role doesn't have
|
||||
this p... */
|
||||
,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
style: FlutterTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: FlutterTheme.of(context).secondaryText,
|
||||
fontSize: 24.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
20
lib/components/on_page_load_model.dart
Normal file
20
lib/components/on_page_load_model.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'on_page_load_widget.dart' show OnPageLoadWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class OnPageLoadModel extends FlutterModel<OnPageLoadWidget> {
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
59
lib/components/on_page_load_widget.dart
Normal file
59
lib/components/on_page_load_widget.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'on_page_load_model.dart';
|
||||
export 'on_page_load_model.dart';
|
||||
|
||||
class OnPageLoadWidget extends StatefulWidget {
|
||||
const OnPageLoadWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_OnPageLoadWidgetState createState() => _OnPageLoadWidgetState();
|
||||
}
|
||||
|
||||
class _OnPageLoadWidgetState extends State<OnPageLoadWidget> {
|
||||
late OnPageLoadModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => OnPageLoadModel());
|
||||
|
||||
// On component load action.
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
||||
setDarkModeSetting(context, ThemeMode.light);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/numstat+black_1.png',
|
||||
width: 61.0,
|
||||
height: 61.0,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
lib/components/permission_list_container1_model.dart
Normal file
44
lib/components/permission_list_container1_model.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import '/components/permission_list_widget.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'permission_list_container1_widget.dart'
|
||||
show PermissionListContainer1Widget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PermissionListContainer1Model
|
||||
extends FlutterModel<PermissionListContainer1Widget> {
|
||||
/// Local state fields for this component.
|
||||
|
||||
List<int> getPermissionsList = [];
|
||||
void addToGetPermissionsList(int item) => getPermissionsList.add(item);
|
||||
void removeFromGetPermissionsList(int item) =>
|
||||
getPermissionsList.remove(item);
|
||||
void removeAtIndexFromGetPermissionsList(int index) =>
|
||||
getPermissionsList.removeAt(index);
|
||||
void insertAtIndexInGetPermissionsList(int index, int item) =>
|
||||
getPermissionsList.insert(index, item);
|
||||
void updateGetPermissionsListAtIndex(int index, Function(int) updateFn) =>
|
||||
getPermissionsList[index] = updateFn(getPermissionsList[index]);
|
||||
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
// Model for PermissionList component.
|
||||
late PermissionListModel permissionListModel;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {
|
||||
permissionListModel = createModel(context, () => PermissionListModel());
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
permissionListModel.dispose();
|
||||
}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
70
lib/components/permission_list_container1_widget.dart
Normal file
70
lib/components/permission_list_container1_widget.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import '/components/permission_list_widget.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'permission_list_container1_model.dart';
|
||||
export 'permission_list_container1_model.dart';
|
||||
|
||||
class PermissionListContainer1Widget extends StatefulWidget {
|
||||
const PermissionListContainer1Widget({
|
||||
Key? key,
|
||||
String? roleID,
|
||||
this.getPermissionsList,
|
||||
}) : this.roleID = roleID ?? '',
|
||||
super(key: key);
|
||||
|
||||
final String roleID;
|
||||
final List<int>? getPermissionsList;
|
||||
|
||||
@override
|
||||
_PermissionListContainer1WidgetState createState() =>
|
||||
_PermissionListContainer1WidgetState();
|
||||
}
|
||||
|
||||
class _PermissionListContainer1WidgetState
|
||||
extends State<PermissionListContainer1Widget> {
|
||||
late PermissionListContainer1Model _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => PermissionListContainer1Model());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, 0.0),
|
||||
child: wrapWithModel(
|
||||
model: _model.permissionListModel,
|
||||
updateCallback: () => setState(() {}),
|
||||
updateOnChange: true,
|
||||
child: PermissionListWidget(
|
||||
roleID: widget.roleID,
|
||||
getPermissionsList: widget.getPermissionsList,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
lib/components/permission_list_container2_model.dart
Normal file
44
lib/components/permission_list_container2_model.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import '/components/permission_list_widget.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'permission_list_container2_widget.dart'
|
||||
show PermissionListContainer2Widget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PermissionListContainer2Model
|
||||
extends FlutterModel<PermissionListContainer2Widget> {
|
||||
/// Local state fields for this component.
|
||||
|
||||
List<int> getPermissionsList = [];
|
||||
void addToGetPermissionsList(int item) => getPermissionsList.add(item);
|
||||
void removeFromGetPermissionsList(int item) =>
|
||||
getPermissionsList.remove(item);
|
||||
void removeAtIndexFromGetPermissionsList(int index) =>
|
||||
getPermissionsList.removeAt(index);
|
||||
void insertAtIndexInGetPermissionsList(int index, int item) =>
|
||||
getPermissionsList.insert(index, item);
|
||||
void updateGetPermissionsListAtIndex(int index, Function(int) updateFn) =>
|
||||
getPermissionsList[index] = updateFn(getPermissionsList[index]);
|
||||
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
// Model for PermissionList component.
|
||||
late PermissionListModel permissionListModel;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {
|
||||
permissionListModel = createModel(context, () => PermissionListModel());
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
permissionListModel.dispose();
|
||||
}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
70
lib/components/permission_list_container2_widget.dart
Normal file
70
lib/components/permission_list_container2_widget.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import '/components/permission_list_widget.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'permission_list_container2_model.dart';
|
||||
export 'permission_list_container2_model.dart';
|
||||
|
||||
class PermissionListContainer2Widget extends StatefulWidget {
|
||||
const PermissionListContainer2Widget({
|
||||
Key? key,
|
||||
String? roleID,
|
||||
this.getPermissionsList,
|
||||
}) : this.roleID = roleID ?? '',
|
||||
super(key: key);
|
||||
|
||||
final String roleID;
|
||||
final List<int>? getPermissionsList;
|
||||
|
||||
@override
|
||||
_PermissionListContainer2WidgetState createState() =>
|
||||
_PermissionListContainer2WidgetState();
|
||||
}
|
||||
|
||||
class _PermissionListContainer2WidgetState
|
||||
extends State<PermissionListContainer2Widget> {
|
||||
late PermissionListContainer2Model _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => PermissionListContainer2Model());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, 0.0),
|
||||
child: wrapWithModel(
|
||||
model: _model.permissionListModel,
|
||||
updateCallback: () => setState(() {}),
|
||||
updateOnChange: true,
|
||||
child: PermissionListWidget(
|
||||
roleID: widget.roleID,
|
||||
getPermissionsList: widget.getPermissionsList,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
lib/components/permission_list_container3_model.dart
Normal file
44
lib/components/permission_list_container3_model.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import '/components/permission_list_widget.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'permission_list_container3_widget.dart'
|
||||
show PermissionListContainer3Widget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PermissionListContainer3Model
|
||||
extends FlutterModel<PermissionListContainer3Widget> {
|
||||
/// Local state fields for this component.
|
||||
|
||||
List<int> getPermissionsList = [];
|
||||
void addToGetPermissionsList(int item) => getPermissionsList.add(item);
|
||||
void removeFromGetPermissionsList(int item) =>
|
||||
getPermissionsList.remove(item);
|
||||
void removeAtIndexFromGetPermissionsList(int index) =>
|
||||
getPermissionsList.removeAt(index);
|
||||
void insertAtIndexInGetPermissionsList(int index, int item) =>
|
||||
getPermissionsList.insert(index, item);
|
||||
void updateGetPermissionsListAtIndex(int index, Function(int) updateFn) =>
|
||||
getPermissionsList[index] = updateFn(getPermissionsList[index]);
|
||||
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
// Model for PermissionList component.
|
||||
late PermissionListModel permissionListModel;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {
|
||||
permissionListModel = createModel(context, () => PermissionListModel());
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
permissionListModel.dispose();
|
||||
}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
70
lib/components/permission_list_container3_widget.dart
Normal file
70
lib/components/permission_list_container3_widget.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import '/components/permission_list_widget.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'permission_list_container3_model.dart';
|
||||
export 'permission_list_container3_model.dart';
|
||||
|
||||
class PermissionListContainer3Widget extends StatefulWidget {
|
||||
const PermissionListContainer3Widget({
|
||||
Key? key,
|
||||
String? roleID,
|
||||
this.getPermissionsList,
|
||||
}) : this.roleID = roleID ?? '',
|
||||
super(key: key);
|
||||
|
||||
final String roleID;
|
||||
final List<int>? getPermissionsList;
|
||||
|
||||
@override
|
||||
_PermissionListContainer3WidgetState createState() =>
|
||||
_PermissionListContainer3WidgetState();
|
||||
}
|
||||
|
||||
class _PermissionListContainer3WidgetState
|
||||
extends State<PermissionListContainer3Widget> {
|
||||
late PermissionListContainer3Model _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => PermissionListContainer3Model());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, 0.0),
|
||||
child: wrapWithModel(
|
||||
model: _model.permissionListModel,
|
||||
updateCallback: () => setState(() {}),
|
||||
updateOnChange: true,
|
||||
child: PermissionListWidget(
|
||||
roleID: widget.roleID,
|
||||
getPermissionsList: widget.getPermissionsList,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
lib/components/permission_list_container_model.dart
Normal file
44
lib/components/permission_list_container_model.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import '/components/permission_list_widget.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'permission_list_container_widget.dart'
|
||||
show PermissionListContainerWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PermissionListContainerModel
|
||||
extends FlutterModel<PermissionListContainerWidget> {
|
||||
/// Local state fields for this component.
|
||||
|
||||
List<int> getPermissionsList = [];
|
||||
void addToGetPermissionsList(int item) => getPermissionsList.add(item);
|
||||
void removeFromGetPermissionsList(int item) =>
|
||||
getPermissionsList.remove(item);
|
||||
void removeAtIndexFromGetPermissionsList(int index) =>
|
||||
getPermissionsList.removeAt(index);
|
||||
void insertAtIndexInGetPermissionsList(int index, int item) =>
|
||||
getPermissionsList.insert(index, item);
|
||||
void updateGetPermissionsListAtIndex(int index, Function(int) updateFn) =>
|
||||
getPermissionsList[index] = updateFn(getPermissionsList[index]);
|
||||
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
// Model for PermissionList component.
|
||||
late PermissionListModel permissionListModel;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {
|
||||
permissionListModel = createModel(context, () => PermissionListModel());
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
permissionListModel.dispose();
|
||||
}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
70
lib/components/permission_list_container_widget.dart
Normal file
70
lib/components/permission_list_container_widget.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import '/components/permission_list_widget.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'permission_list_container_model.dart';
|
||||
export 'permission_list_container_model.dart';
|
||||
|
||||
class PermissionListContainerWidget extends StatefulWidget {
|
||||
const PermissionListContainerWidget({
|
||||
Key? key,
|
||||
String? roleID,
|
||||
this.getPermissionsList,
|
||||
}) : this.roleID = roleID ?? '',
|
||||
super(key: key);
|
||||
|
||||
final String roleID;
|
||||
final List<int>? getPermissionsList;
|
||||
|
||||
@override
|
||||
_PermissionListContainerWidgetState createState() =>
|
||||
_PermissionListContainerWidgetState();
|
||||
}
|
||||
|
||||
class _PermissionListContainerWidgetState
|
||||
extends State<PermissionListContainerWidget> {
|
||||
late PermissionListContainerModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => PermissionListContainerModel());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0.0, 0.0),
|
||||
child: wrapWithModel(
|
||||
model: _model.permissionListModel,
|
||||
updateCallback: () => setState(() {}),
|
||||
updateOnChange: true,
|
||||
child: PermissionListWidget(
|
||||
roleID: widget.roleID,
|
||||
getPermissionsList: widget.getPermissionsList,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
33
lib/components/permission_list_model.dart
Normal file
33
lib/components/permission_list_model.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import '/backend/api_requests/api_calls.dart';
|
||||
import '/components/checkbox_widget.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'permission_list_widget.dart' show PermissionListWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PermissionListModel extends FlutterModel<PermissionListWidget> {
|
||||
/// Local state fields for this component.
|
||||
|
||||
List<int> permissionsList = [];
|
||||
void addToPermissionsList(int item) => permissionsList.add(item);
|
||||
void removeFromPermissionsList(int item) => permissionsList.remove(item);
|
||||
void removeAtIndexFromPermissionsList(int index) =>
|
||||
permissionsList.removeAt(index);
|
||||
void insertAtIndexInPermissionsList(int index, int item) =>
|
||||
permissionsList.insert(index, item);
|
||||
void updatePermissionsListAtIndex(int index, Function(int) updateFn) =>
|
||||
permissionsList[index] = updateFn(permissionsList[index]);
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {}
|
||||
|
||||
void dispose() {}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
}
|
||||
151
lib/components/permission_list_view_model.dart
Normal file
151
lib/components/permission_list_view_model.dart
Normal file
@@ -0,0 +1,151 @@
|
||||
import '/backend/api_requests/api_calls.dart';
|
||||
import '/components/permission_list_container1_widget.dart';
|
||||
import '/components/permission_list_container2_widget.dart';
|
||||
import '/components/permission_list_container3_widget.dart';
|
||||
import '/components/permission_list_container_widget.dart';
|
||||
import '/flutterlib/flutter_drop_down.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import '/flutterlib/form_field_controller.dart';
|
||||
import '/flutterlib/custom_functions.dart' as functions;
|
||||
import 'dart:async';
|
||||
import 'permission_list_view_widget.dart' show PermissionListViewWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PermissionListViewModel
|
||||
extends FlutterModel<PermissionListViewWidget> {
|
||||
/// Local state fields for this component.
|
||||
|
||||
String roleID = '';
|
||||
|
||||
List<int> getPermissionsLIst = [];
|
||||
void addToGetPermissionsLIst(int item) => getPermissionsLIst.add(item);
|
||||
void removeFromGetPermissionsLIst(int item) =>
|
||||
getPermissionsLIst.remove(item);
|
||||
void removeAtIndexFromGetPermissionsLIst(int index) =>
|
||||
getPermissionsLIst.removeAt(index);
|
||||
void insertAtIndexInGetPermissionsLIst(int index, int item) =>
|
||||
getPermissionsLIst.insert(index, item);
|
||||
void updateGetPermissionsLIstAtIndex(int index, Function(int) updateFn) =>
|
||||
getPermissionsLIst[index] = updateFn(getPermissionsLIst[index]);
|
||||
|
||||
List<int> getPermissionsLIst1 = [];
|
||||
void addToGetPermissionsLIst1(int item) => getPermissionsLIst1.add(item);
|
||||
void removeFromGetPermissionsLIst1(int item) =>
|
||||
getPermissionsLIst1.remove(item);
|
||||
void removeAtIndexFromGetPermissionsLIst1(int index) =>
|
||||
getPermissionsLIst1.removeAt(index);
|
||||
void insertAtIndexInGetPermissionsLIst1(int index, int item) =>
|
||||
getPermissionsLIst1.insert(index, item);
|
||||
void updateGetPermissionsLIst1AtIndex(int index, Function(int) updateFn) =>
|
||||
getPermissionsLIst1[index] = updateFn(getPermissionsLIst1[index]);
|
||||
|
||||
List<int> getPermissionsList2 = [];
|
||||
void addToGetPermissionsList2(int item) => getPermissionsList2.add(item);
|
||||
void removeFromGetPermissionsList2(int item) =>
|
||||
getPermissionsList2.remove(item);
|
||||
void removeAtIndexFromGetPermissionsList2(int index) =>
|
||||
getPermissionsList2.removeAt(index);
|
||||
void insertAtIndexInGetPermissionsList2(int index, int item) =>
|
||||
getPermissionsList2.insert(index, item);
|
||||
void updateGetPermissionsList2AtIndex(int index, Function(int) updateFn) =>
|
||||
getPermissionsList2[index] = updateFn(getPermissionsList2[index]);
|
||||
|
||||
List<int> getPermissionsList3 = [];
|
||||
void addToGetPermissionsList3(int item) => getPermissionsList3.add(item);
|
||||
void removeFromGetPermissionsList3(int item) =>
|
||||
getPermissionsList3.remove(item);
|
||||
void removeAtIndexFromGetPermissionsList3(int index) =>
|
||||
getPermissionsList3.removeAt(index);
|
||||
void insertAtIndexInGetPermissionsList3(int index, int item) =>
|
||||
getPermissionsList3.insert(index, item);
|
||||
void updateGetPermissionsList3AtIndex(int index, Function(int) updateFn) =>
|
||||
getPermissionsList3[index] = updateFn(getPermissionsList3[index]);
|
||||
|
||||
int? loopCounter = 0;
|
||||
|
||||
List<String> filteredRemovePermissions = [];
|
||||
void addToFilteredRemovePermissions(String item) =>
|
||||
filteredRemovePermissions.add(item);
|
||||
void removeFromFilteredRemovePermissions(String item) =>
|
||||
filteredRemovePermissions.remove(item);
|
||||
void removeAtIndexFromFilteredRemovePermissions(int index) =>
|
||||
filteredRemovePermissions.removeAt(index);
|
||||
void insertAtIndexInFilteredRemovePermissions(int index, String item) =>
|
||||
filteredRemovePermissions.insert(index, item);
|
||||
void updateFilteredRemovePermissionsAtIndex(
|
||||
int index, Function(String) updateFn) =>
|
||||
filteredRemovePermissions[index] =
|
||||
updateFn(filteredRemovePermissions[index]);
|
||||
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
Completer<ApiCallResponse>? apiRequestCompleter;
|
||||
// Stores action output result for [Backend Call - API (Get Permission of Role)] action in PermissionListView widget.
|
||||
ApiCallResponse? apiResults0e;
|
||||
// Stores action output result for [Backend Call - API (Get Permission of Role)] action in PermissionListView widget.
|
||||
ApiCallResponse? apiResults0a;
|
||||
// Stores action output result for [Backend Call - API (Get Permission of Role)] action in PermissionListView widget.
|
||||
ApiCallResponse? apiResults0c;
|
||||
// Stores action output result for [Backend Call - API (Get Permission of Role)] action in PermissionListView widget.
|
||||
ApiCallResponse? apiResults0d;
|
||||
// State field(s) for role1223 widget.
|
||||
String? role1223Value;
|
||||
FormFieldController<String>? role1223ValueController;
|
||||
// Model for PermissionListContainer component.
|
||||
late PermissionListContainerModel permissionListContainerModel;
|
||||
// Model for PermissionListContainer1 component.
|
||||
late PermissionListContainer1Model permissionListContainer1Model;
|
||||
// Model for PermissionListContainer2 component.
|
||||
late PermissionListContainer2Model permissionListContainer2Model;
|
||||
// Model for PermissionListContainer3 component.
|
||||
late PermissionListContainer3Model permissionListContainer3Model;
|
||||
// Stores action output result for [Backend Call - API (Add permission to role)] action in Button widget.
|
||||
ApiCallResponse? apiResulttvj;
|
||||
// Stores action output result for [Backend Call - API (Remove Permission to role)] action in Button widget.
|
||||
ApiCallResponse? apiResulttvq;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {
|
||||
permissionListContainerModel =
|
||||
createModel(context, () => PermissionListContainerModel());
|
||||
permissionListContainer1Model =
|
||||
createModel(context, () => PermissionListContainer1Model());
|
||||
permissionListContainer2Model =
|
||||
createModel(context, () => PermissionListContainer2Model());
|
||||
permissionListContainer3Model =
|
||||
createModel(context, () => PermissionListContainer3Model());
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
permissionListContainerModel.dispose();
|
||||
permissionListContainer1Model.dispose();
|
||||
permissionListContainer2Model.dispose();
|
||||
permissionListContainer3Model.dispose();
|
||||
}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
|
||||
Future waitForApiRequestCompleted({
|
||||
double minWait = 0,
|
||||
double maxWait = double.infinity,
|
||||
}) async {
|
||||
final stopwatch = Stopwatch()..start();
|
||||
while (true) {
|
||||
await Future.delayed(Duration(milliseconds: 50));
|
||||
final timeElapsed = stopwatch.elapsedMilliseconds;
|
||||
final requestComplete = apiRequestCompleter?.isCompleted ?? false;
|
||||
if (timeElapsed > maxWait || (requestComplete && timeElapsed > minWait)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
439
lib/components/permission_list_view_widget.dart
Normal file
439
lib/components/permission_list_view_widget.dart
Normal file
@@ -0,0 +1,439 @@
|
||||
import '/backend/api_requests/api_calls.dart';
|
||||
import '/components/permission_list_container1_widget.dart';
|
||||
import '/components/permission_list_container2_widget.dart';
|
||||
import '/components/permission_list_container3_widget.dart';
|
||||
import '/components/permission_list_container_widget.dart';
|
||||
import '/flutterlib/flutter_drop_down.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import '/flutterlib/form_field_controller.dart';
|
||||
import '/flutterlib/custom_functions.dart' as functions;
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'permission_list_view_model.dart';
|
||||
export 'permission_list_view_model.dart';
|
||||
|
||||
class PermissionListViewWidget extends StatefulWidget {
|
||||
const PermissionListViewWidget({
|
||||
Key? key,
|
||||
this.parameter1,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<int>? parameter1;
|
||||
|
||||
@override
|
||||
_PermissionListViewWidgetState createState() =>
|
||||
_PermissionListViewWidgetState();
|
||||
}
|
||||
|
||||
class _PermissionListViewWidgetState extends State<PermissionListViewWidget> {
|
||||
late PermissionListViewModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => PermissionListViewModel());
|
||||
|
||||
// On component load action.
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
||||
setState(() {
|
||||
_model.getPermissionsLIst = [];
|
||||
_model.getPermissionsLIst1 = [];
|
||||
_model.getPermissionsList2 = [];
|
||||
_model.getPermissionsList3 = [];
|
||||
});
|
||||
setState(() => _model.apiRequestCompleter = null);
|
||||
await _model.waitForApiRequestCompleted();
|
||||
_model.apiResults0e = await NumstationGroup.getPermissionOfRoleCall.call(
|
||||
token: FFAppState().token,
|
||||
roleId: '7',
|
||||
);
|
||||
if ((_model.apiResults0e?.succeeded ?? true)) {
|
||||
_model.updatePage(() {
|
||||
_model.getPermissionsLIst = NumstationGroup.getPermissionOfRoleCall
|
||||
.getPermissionsID(
|
||||
(_model.apiResults0e?.jsonBody ?? ''),
|
||||
)!
|
||||
.toList()
|
||||
.cast<int>();
|
||||
});
|
||||
} else {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (alertDialogContext) {
|
||||
return AlertDialog(
|
||||
content: Text('Failed!'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(alertDialogContext),
|
||||
child: Text('Ok'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
_model.apiResults0a = await NumstationGroup.getPermissionOfRoleCall.call(
|
||||
token: FFAppState().token,
|
||||
roleId: '8',
|
||||
);
|
||||
if ((_model.apiResults0a?.succeeded ?? true)) {
|
||||
_model.updatePage(() {
|
||||
_model.getPermissionsLIst1 = NumstationGroup.getPermissionOfRoleCall
|
||||
.getPermissionsID(
|
||||
(_model.apiResults0a?.jsonBody ?? ''),
|
||||
)!
|
||||
.toList()
|
||||
.cast<int>();
|
||||
});
|
||||
} else {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (alertDialogContext) {
|
||||
return AlertDialog(
|
||||
content: Text('Failed!'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(alertDialogContext),
|
||||
child: Text('Ok'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
_model.apiResults0c = await NumstationGroup.getPermissionOfRoleCall.call(
|
||||
token: FFAppState().token,
|
||||
roleId: '9',
|
||||
);
|
||||
if ((_model.apiResults0c?.succeeded ?? true)) {
|
||||
_model.updatePage(() {
|
||||
_model.getPermissionsList2 = NumstationGroup.getPermissionOfRoleCall
|
||||
.getPermissionsID(
|
||||
(_model.apiResults0c?.jsonBody ?? ''),
|
||||
)!
|
||||
.toList()
|
||||
.cast<int>();
|
||||
});
|
||||
} else {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (alertDialogContext) {
|
||||
return AlertDialog(
|
||||
content: Text('Failed!'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(alertDialogContext),
|
||||
child: Text('Ok'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
_model.apiResults0d = await NumstationGroup.getPermissionOfRoleCall.call(
|
||||
token: FFAppState().token,
|
||||
roleId: '10',
|
||||
);
|
||||
if ((_model.apiResults0d?.succeeded ?? true)) {
|
||||
_model.updatePage(() {
|
||||
_model.getPermissionsList3 = NumstationGroup.getPermissionOfRoleCall
|
||||
.getPermissionsID(
|
||||
(_model.apiResults0d?.jsonBody ?? ''),
|
||||
)!
|
||||
.toList()
|
||||
.cast<int>();
|
||||
});
|
||||
} else {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (alertDialogContext) {
|
||||
return AlertDialog(
|
||||
content: Text('Failed!'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(alertDialogContext),
|
||||
child: Text('Ok'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0),
|
||||
child: ListView(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
0,
|
||||
5.0,
|
||||
0,
|
||||
10.0,
|
||||
),
|
||||
scrollDirection: Axis.vertical,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(0.0, -1.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 10.0),
|
||||
child: FutureBuilder<ApiCallResponse>(
|
||||
future: (_model.apiRequestCompleter ??=
|
||||
Completer<ApiCallResponse>()
|
||||
..complete(NumstationGroup.roleListCall.call(
|
||||
token: FFAppState().token,
|
||||
)))
|
||||
.future,
|
||||
builder: (context, snapshot) {
|
||||
// Customize what your widget looks like when it's loading.
|
||||
if (!snapshot.hasData) {
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
FlutterTheme.of(context).info,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
final role1223RoleListResponse = snapshot.data!;
|
||||
return FlutterDropDown<String>(
|
||||
controller: _model.role1223ValueController ??=
|
||||
FormFieldController<String>(null),
|
||||
options: List<String>.from((getJsonField(
|
||||
role1223RoleListResponse.jsonBody,
|
||||
r'''$.roles..id''',
|
||||
true,
|
||||
) as List)
|
||||
.map<String>((s) => s.toString())
|
||||
.toList()!),
|
||||
optionLabels: functions.addAccessRightPrefix(getJsonField(
|
||||
role1223RoleListResponse.jsonBody,
|
||||
r'''$.roles..display_name''',
|
||||
true,
|
||||
)!),
|
||||
onChanged: (val) async {
|
||||
setState(() => _model.role1223Value = val);
|
||||
_model.updatePage(() {
|
||||
_model.roleID = _model.role1223Value!;
|
||||
});
|
||||
FFAppState().update(() {
|
||||
FFAppState().deleteAddPermissionsID();
|
||||
FFAppState().addPermissionsID = [];
|
||||
|
||||
FFAppState().deleteRemovePermissionsID();
|
||||
FFAppState().removePermissionsID = [];
|
||||
});
|
||||
},
|
||||
width: 360.0,
|
||||
height: 43.0,
|
||||
textStyle:
|
||||
FlutterTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
lineHeight: 1.2,
|
||||
),
|
||||
hintText: FFLocalizations.of(context).getText(
|
||||
'wm69kw1i' /* Access right : */,
|
||||
),
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_down_rounded,
|
||||
color: FlutterTheme.of(context).secondaryText,
|
||||
size: 24.0,
|
||||
),
|
||||
fillColor:
|
||||
FlutterTheme.of(context).secondaryBackground,
|
||||
elevation: 2.0,
|
||||
borderColor: FlutterTheme.of(context).alternate,
|
||||
borderWidth: 2.0,
|
||||
borderRadius: 8.0,
|
||||
margin:
|
||||
EdgeInsetsDirectional.fromSTEB(10.0, 4.0, 16.0, 4.0),
|
||||
hidesUnderline: true,
|
||||
isSearchable: false,
|
||||
isMultiSelect: false,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_model.roleID == '7')
|
||||
wrapWithModel(
|
||||
model: _model.permissionListContainerModel,
|
||||
updateCallback: () => setState(() {}),
|
||||
updateOnChange: true,
|
||||
child: PermissionListContainerWidget(
|
||||
roleID: _model.role1223Value,
|
||||
getPermissionsList: _model.getPermissionsLIst,
|
||||
),
|
||||
),
|
||||
if (_model.roleID == '8')
|
||||
wrapWithModel(
|
||||
model: _model.permissionListContainer1Model,
|
||||
updateCallback: () => setState(() {}),
|
||||
child: PermissionListContainer1Widget(
|
||||
getPermissionsList: _model.getPermissionsLIst1,
|
||||
),
|
||||
),
|
||||
if (_model.roleID == '9')
|
||||
wrapWithModel(
|
||||
model: _model.permissionListContainer2Model,
|
||||
updateCallback: () => setState(() {}),
|
||||
child: PermissionListContainer2Widget(
|
||||
getPermissionsList: _model.getPermissionsList2,
|
||||
),
|
||||
),
|
||||
if (_model.roleID == '10')
|
||||
wrapWithModel(
|
||||
model: _model.permissionListContainer3Model,
|
||||
updateCallback: () => setState(() {}),
|
||||
child: PermissionListContainer3Widget(
|
||||
getPermissionsList: _model.getPermissionsList3,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
FFButtonWidget(
|
||||
onPressed: () async {
|
||||
while (_model.loopCounter! <
|
||||
FFAppState().addPermissionsID.length) {
|
||||
_model.apiResulttvj =
|
||||
await NumstationGroup.addPermissionToRoleCall.call(
|
||||
token: FFAppState().token,
|
||||
roleId: _model.roleID,
|
||||
permissionId:
|
||||
FFAppState().addPermissionsID[_model.loopCounter!],
|
||||
);
|
||||
setState(() {
|
||||
_model.loopCounter = _model.loopCounter! + 1;
|
||||
});
|
||||
}
|
||||
_model.updatePage(() {
|
||||
_model.loopCounter = 0;
|
||||
_model.filteredRemovePermissions = functions
|
||||
.filteredRemovePermissions(
|
||||
FFAppState().addPermissionsID.toList(),
|
||||
FFAppState().removePermissionsID.toList())
|
||||
.toList()
|
||||
.cast<String>();
|
||||
});
|
||||
while (_model.loopCounter! <
|
||||
_model.filteredRemovePermissions.length) {
|
||||
_model.apiResulttvq =
|
||||
await NumstationGroup.removePermissionToRoleCall.call(
|
||||
token: FFAppState().token,
|
||||
roleId: _model.roleID,
|
||||
permissionId:
|
||||
_model.filteredRemovePermissions[_model.loopCounter!],
|
||||
);
|
||||
setState(() {
|
||||
_model.loopCounter = _model.loopCounter! + 1;
|
||||
});
|
||||
}
|
||||
_model.updatePage(() {
|
||||
_model.loopCounter = 0;
|
||||
});
|
||||
setState(() {
|
||||
FFAppState().deleteAddPermissionsID();
|
||||
FFAppState().addPermissionsID = [];
|
||||
|
||||
FFAppState().deleteRemovePermissionsID();
|
||||
FFAppState().removePermissionsID = [];
|
||||
});
|
||||
|
||||
context.pushNamed('user');
|
||||
|
||||
setState(() {});
|
||||
},
|
||||
text: FFLocalizations.of(context).getText(
|
||||
'hke183b6' /* Save */,
|
||||
),
|
||||
options: FFButtonOptions(
|
||||
width: 159.0,
|
||||
height: 50.0,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
||||
iconPadding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||
color: Color(0xFF009B9A),
|
||||
textStyle: FlutterTheme.of(context).titleSmall.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
elevation: 3.0,
|
||||
borderSide: BorderSide(
|
||||
color: Colors.transparent,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(40.0),
|
||||
),
|
||||
),
|
||||
FFButtonWidget(
|
||||
onPressed: () async {
|
||||
context.pushNamed('user');
|
||||
},
|
||||
text: FFLocalizations.of(context).getText(
|
||||
'9enzv173' /* Reset */,
|
||||
),
|
||||
options: FFButtonOptions(
|
||||
width: 159.0,
|
||||
height: 50.0,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
||||
iconPadding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||
color: Color(0xFF9B0025),
|
||||
textStyle: FlutterTheme.of(context).titleSmall.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
elevation: 3.0,
|
||||
borderSide: BorderSide(
|
||||
color: Colors.transparent,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(40.0),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
281
lib/components/permission_list_widget.dart
Normal file
281
lib/components/permission_list_widget.dart
Normal file
@@ -0,0 +1,281 @@
|
||||
import '/backend/api_requests/api_calls.dart';
|
||||
import '/components/checkbox_widget.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'permission_list_model.dart';
|
||||
export 'permission_list_model.dart';
|
||||
|
||||
class PermissionListWidget extends StatefulWidget {
|
||||
const PermissionListWidget({
|
||||
Key? key,
|
||||
this.roleID,
|
||||
this.getPermissionsList,
|
||||
}) : super(key: key);
|
||||
|
||||
final String? roleID;
|
||||
final List<int>? getPermissionsList;
|
||||
|
||||
@override
|
||||
_PermissionListWidgetState createState() => _PermissionListWidgetState();
|
||||
}
|
||||
|
||||
class _PermissionListWidgetState extends State<PermissionListWidget> {
|
||||
late PermissionListModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => PermissionListModel());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: FutureBuilder<ApiCallResponse>(
|
||||
future: NumstationGroup.groupPermissionsCall.call(
|
||||
token: FFAppState().token,
|
||||
),
|
||||
builder: (context, snapshot) {
|
||||
// Customize what your widget looks like when it's loading.
|
||||
if (!snapshot.hasData) {
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
FlutterTheme.of(context).info,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
final columnGroupPermissionsResponse = snapshot.data!;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 358.0,
|
||||
height: 38.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF4F7FA),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
5.0, 0.0, 0.0, 0.0),
|
||||
child: Text(
|
||||
getJsonField(
|
||||
columnGroupPermissionsResponse.jsonBody,
|
||||
r'''$.group[?(@.id == 3)].name''',
|
||||
).toString(),
|
||||
style: FlutterTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 16.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final group3 = getJsonField(
|
||||
columnGroupPermissionsResponse.jsonBody,
|
||||
r'''$.group[?(@.id == 3)].permissions[*]''',
|
||||
).toList();
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children:
|
||||
List.generate(group3.length, (group3Index) {
|
||||
final group3Item = group3[group3Index];
|
||||
return CheckboxWidget(
|
||||
key: Key(
|
||||
'Key4rz_${group3Index}_of_${group3.length}'),
|
||||
permissionList: group3Item,
|
||||
getPermissions: widget.getPermissionsList,
|
||||
);
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 358.0,
|
||||
height: 38.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF4F7FA),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
5.0, 0.0, 0.0, 0.0),
|
||||
child: Text(
|
||||
getJsonField(
|
||||
columnGroupPermissionsResponse.jsonBody,
|
||||
r'''$.group[?(@.id == 4)].name''',
|
||||
).toString(),
|
||||
style: FlutterTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 16.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final group4 = getJsonField(
|
||||
columnGroupPermissionsResponse.jsonBody,
|
||||
r'''$.group[?(@.id == 4)].permissions[*]''',
|
||||
).toList();
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children:
|
||||
List.generate(group4.length, (group4Index) {
|
||||
final group4Item = group4[group4Index];
|
||||
return CheckboxWidget(
|
||||
key: Key(
|
||||
'Keymaw_${group4Index}_of_${group4.length}'),
|
||||
permissionList: group4Item,
|
||||
getPermissions: widget.getPermissionsList,
|
||||
);
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 358.0,
|
||||
height: 38.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF4F7FA),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
5.0, 0.0, 0.0, 0.0),
|
||||
child: Text(
|
||||
getJsonField(
|
||||
columnGroupPermissionsResponse.jsonBody,
|
||||
r'''$.group[?(@.id == 5)].name''',
|
||||
).toString(),
|
||||
style: FlutterTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 16.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final group5 = getJsonField(
|
||||
columnGroupPermissionsResponse.jsonBody,
|
||||
r'''$.group[?(@.id == 5)].permissions[*]''',
|
||||
).toList();
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children:
|
||||
List.generate(group5.length, (group5Index) {
|
||||
final group5Item = group5[group5Index];
|
||||
return CheckboxWidget(
|
||||
key: Key(
|
||||
'Key9tj_${group5Index}_of_${group5.length}'),
|
||||
permissionList: group5Item,
|
||||
getPermissions: widget.getPermissionsList,
|
||||
);
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
260
lib/components/update_member_model.dart
Normal file
260
lib/components/update_member_model.dart
Normal file
@@ -0,0 +1,260 @@
|
||||
import '/backend/api_requests/api_calls.dart';
|
||||
import '/components/alert_box_custom_o_k_widget.dart';
|
||||
import '/components/alert_box_custom_widget.dart';
|
||||
import '/flutterlib/flutter_drop_down.dart';
|
||||
import '/flutterlib/flutter_icon_button.dart';
|
||||
import '/flutterlib/flutter_radio_button.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import '/flutterlib/form_field_controller.dart';
|
||||
import '/flutterlib/upload_data.dart';
|
||||
import '/flutterlib/custom_functions.dart' as functions;
|
||||
import 'update_member_widget.dart' show UpdateMemberWidget;
|
||||
import 'package:aligned_dialog/aligned_dialog.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class UpdateMemberModel extends FlutterModel<UpdateMemberWidget> {
|
||||
/// Local state fields for this component.
|
||||
|
||||
dynamic memberData;
|
||||
|
||||
dynamic companyID;
|
||||
|
||||
bool setBirthDate = false;
|
||||
|
||||
bool uploadPhoto = false;
|
||||
|
||||
bool reuploadPhoto = false;
|
||||
|
||||
bool hideApiPhoto = false;
|
||||
|
||||
int? documentID;
|
||||
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
final formKey = GlobalKey<FormState>();
|
||||
// State field(s) for position widget.
|
||||
FormFieldController<String>? positionValueController;
|
||||
// State field(s) for title widget.
|
||||
String? titleValue;
|
||||
FormFieldController<String>? titleValueController;
|
||||
// State field(s) for name_english widget.
|
||||
FocusNode? nameEnglishFocusNode;
|
||||
TextEditingController? nameEnglishController;
|
||||
String? Function(BuildContext, String?)? nameEnglishControllerValidator;
|
||||
String? _nameEnglishControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'4okvufdw' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for name_chinese widget.
|
||||
FocusNode? nameChineseFocusNode;
|
||||
TextEditingController? nameChineseController;
|
||||
String? Function(BuildContext, String?)? nameChineseControllerValidator;
|
||||
String? _nameChineseControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'1aer0il2' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for phone widget.
|
||||
FocusNode? phoneFocusNode;
|
||||
TextEditingController? phoneController;
|
||||
String? Function(BuildContext, String?)? phoneControllerValidator;
|
||||
String? _phoneControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'1o5n5vu2' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for email widget.
|
||||
FocusNode? emailFocusNode;
|
||||
TextEditingController? emailController;
|
||||
String? Function(BuildContext, String?)? emailControllerValidator;
|
||||
String? _emailControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'gxrowkvz' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for date widget.
|
||||
FocusNode? dateFocusNode;
|
||||
TextEditingController? dateController;
|
||||
String? Function(BuildContext, String?)? dateControllerValidator;
|
||||
String? _dateControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'ip2ppggj' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
DateTime? datePicked;
|
||||
// State field(s) for documentType widget.
|
||||
String? documentTypeValue;
|
||||
FormFieldController<String>? documentTypeValueController;
|
||||
// State field(s) for documentNo widget.
|
||||
FocusNode? documentNoFocusNode;
|
||||
TextEditingController? documentNoController;
|
||||
String? Function(BuildContext, String?)? documentNoControllerValidator;
|
||||
String? _documentNoControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'agnaksg0' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for country widget.
|
||||
FocusNode? countryFocusNode;
|
||||
TextEditingController? countryController;
|
||||
String? Function(BuildContext, String?)? countryControllerValidator;
|
||||
String? _countryControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'gbnww8g4' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for city widget.
|
||||
FocusNode? cityFocusNode;
|
||||
TextEditingController? cityController;
|
||||
String? Function(BuildContext, String?)? cityControllerValidator;
|
||||
String? _cityControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'4lmj71tb' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for addressEn widget.
|
||||
FocusNode? addressEnFocusNode;
|
||||
TextEditingController? addressEnController;
|
||||
String? Function(BuildContext, String?)? addressEnControllerValidator;
|
||||
String? _addressEnControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'8og0cme2' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for addressCn widget.
|
||||
FocusNode? addressCnFocusNode;
|
||||
TextEditingController? addressCnController;
|
||||
String? Function(BuildContext, String?)? addressCnControllerValidator;
|
||||
String? _addressCnControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'7hdsppit' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Stores action output result for [Backend Call - API (Delete Member Document)] action in Text widget.
|
||||
ApiCallResponse? deleteDocument1;
|
||||
bool isDataUploading1 = false;
|
||||
FFUploadedFile uploadedLocalFile1 =
|
||||
FFUploadedFile(bytes: Uint8List.fromList([]));
|
||||
|
||||
// Stores action output result for [Backend Call - API (Delete Member Document)] action in Text widget.
|
||||
ApiCallResponse? deleteDocument;
|
||||
bool isDataUploading2 = false;
|
||||
FFUploadedFile uploadedLocalFile2 =
|
||||
FFUploadedFile(bytes: Uint8List.fromList([]));
|
||||
|
||||
// Stores action output result for [Backend Call - API (Save or Update Member)] action in Button widget.
|
||||
ApiCallResponse? updateMember1;
|
||||
// Stores action output result for [Backend Call - API (Save or Update Member)] action in Button widget.
|
||||
ApiCallResponse? updateMember2;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {
|
||||
nameEnglishControllerValidator = _nameEnglishControllerValidator;
|
||||
nameChineseControllerValidator = _nameChineseControllerValidator;
|
||||
phoneControllerValidator = _phoneControllerValidator;
|
||||
emailControllerValidator = _emailControllerValidator;
|
||||
dateControllerValidator = _dateControllerValidator;
|
||||
documentNoControllerValidator = _documentNoControllerValidator;
|
||||
countryControllerValidator = _countryControllerValidator;
|
||||
cityControllerValidator = _cityControllerValidator;
|
||||
addressEnControllerValidator = _addressEnControllerValidator;
|
||||
addressCnControllerValidator = _addressCnControllerValidator;
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
nameEnglishFocusNode?.dispose();
|
||||
nameEnglishController?.dispose();
|
||||
|
||||
nameChineseFocusNode?.dispose();
|
||||
nameChineseController?.dispose();
|
||||
|
||||
phoneFocusNode?.dispose();
|
||||
phoneController?.dispose();
|
||||
|
||||
emailFocusNode?.dispose();
|
||||
emailController?.dispose();
|
||||
|
||||
dateFocusNode?.dispose();
|
||||
dateController?.dispose();
|
||||
|
||||
documentNoFocusNode?.dispose();
|
||||
documentNoController?.dispose();
|
||||
|
||||
countryFocusNode?.dispose();
|
||||
countryController?.dispose();
|
||||
|
||||
cityFocusNode?.dispose();
|
||||
cityController?.dispose();
|
||||
|
||||
addressEnFocusNode?.dispose();
|
||||
addressEnController?.dispose();
|
||||
|
||||
addressCnFocusNode?.dispose();
|
||||
addressCnController?.dispose();
|
||||
}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
|
||||
String? get positionValue => positionValueController?.value;
|
||||
}
|
||||
1837
lib/components/update_member_widget.dart
Normal file
1837
lib/components/update_member_widget.dart
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user