bizdoc 0.0.6 bizdoc: ^0.0.6 copied to clipboard
Workflow forms for corporate.
Create form-driven mobile apps on top of BizDoc workflow engine.
Features #
- Authentication: Okta or Credentials.
- Online messages and notifications.
- Analysis charts.
- Dashboard widgets.
- Capture and attach file from camera.
- Location sensitive forms.
- Geo location services.
Getting started #
flutter pub add provider
If you are going to access self owned server APIs, install dio.
flutter pub add dio
BizDoc mobile app relays on Firebase messaging. To fully take advantage of BizDocApp you'll need to create a Firebase project and provide it's settings to BizDoc.
Usage #
Add BizDocApp
to main.dart.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BizDocApp(
serverAddress: 'https://bizdoc-server-here',
authentication: Credentials());
}
}
Set authentication #
Set method according to server configuration.
Provider | Usage |
---|---|
Okta | Okta. |
Credentials | Username password authentication. |
Declare components #
BizDoc components are widgets which can access app state and services. Flutter support two types of BizDoc components: form and widget.
First, declare a stateful widget.
class MyComponent extends StatefulWidget {
@override
_MyComponentState createState() => _MyComponentState();
}
Register components #
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BizDocApp(
resolve: {'my-component': (context) => MyComponent()},
}
}
Forms #
A form is a component type which offers a user to fill a series of inputs.
Declare model #
class MyModel {
final Map<String, dynamic> _json;
MyModel(this._json);
String? get subject => _json['subject'];
set subject(String? val) => _json['subject'] = val;
num? get price => _json['price'];
set price(num? val) => _json['price'] = val;
}
Here we use a getter and setter for each property. You can deserialize json using fromJson() pattern.
Manage state #
Access form state using BizDocFormState
.
class _MyComponentState extends State<MyComponent> {
late BizDocFormState _state;
late _model MyModel;
@override initState() {
_state = Provider.of<BizDocFormState>(context, listen: false);
_model = MyModel(_state.data);
super.initState();
}
}
Update state on input change.
TextFormField(
keyboardType: TextInputType.text,
controller: new TextEditingController(text: _model.subject),
onChanged: (value) {
_model.subject = value;
_state.setDirty();
},
validator: (value) {
if (value != null && value != '') _state.setInvalid();
else if (_model.isValid) _state.setValid();
},
),
Control widgets #
Embed BizDoc control in your components to gain simplification of API use.
Name | Usage |
---|---|
CombinationPicker | Combination input. |
CombinationPool | Combination input. |
SelectField | Picker for datatype. |
AutocompleteField | Autocomplete picker for datatype. |
AddressField | Autocomplete address input. Set GoogleMapsSettings property in BizDocApp. |
Integrate APIs #
Use extension or singleton var to access BizDoc services.
Services available:
Name | Usage |
---|---|
DataSource | Retrieve BizDoc datatype values. |
Users | Retrieve user(s) profile. |
Geo | Geo location services. Set GoogleMapsSettings property in BizDocApp. |
Cube | Analysis backend API. |
Session | Current session state. |
extension MyModel on DataSource {
Future<Map<String, dynamic>> companies(){
return map('countries');
}
Future<Iterable<VendorInfo>> vendors(String? name){
final response = dio.get('/vendors/', queryParameters: {'name': name });
return response.data.map((e)=> VendorInfo(e));
}
}
class VendorInfo {
final Map<String, dynamic> _json;
VendorInfo(this._json);
String? get name => _json['name'];
}
Use dio property to send an HTTP request to server /api.
Utilize in widgets.
let vendors = await dataSource.vendors();
Dashboard widgets #
Use BizDocWidgetState
to get remote data.
class CubeAnalysisWidget extends StatefulWidget implements IDashboardWidget {
const CubeAnalysisWidget({Key? key}) : super(key: key);
@override
_CubeAnalysisWidgetState createState() => _CubeAnalysisWidgetState();
}
class _CubeAnalysisWidgetState extends State<CubeAnalysisWidget> {
@override
Widget build(BuildContext context) {
return Consumer<BizDocWidgetState>(builder: (context, value, child) {
if (value.hasData)
for (var item in value.data!) {
...
}
}
}
}
Register component in BizDocApp resolve.
Settings #
To fully take advantage of BizDoc app, add messaging and APIs settings.
Push messages #
Firebase project FirebaseSettings
of BizDocApp main.dart.
Geo location services #
Google maps API in GoogleMapsSettings
of BizDocApp in main.dart.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => BizDocApp(
firebaseSettings: FirebaseSettings(
apiKey: '...',
projectId: '...',
senderId: '...',
vapidKey: '...',
appId: '...'),
googleMapsSettings: GoogleMapsSettings(apiKey: '...'),
);
}
Additional information #
Server development guide, and wiki.
Contact Moding team for demo and pricing.