apptive_grid_heinzelmen 3.0.1 apptive_grid_heinzelmen: ^3.0.1 copied to clipboard
A collection of little helpers for Flutter Apps that use ApptiveGrid.
ApptiveGrid Heinzelmen #
These are little helper heinzelmen to help with the ApptiveGrid Flutter Packages
Attachment Image #
Display an Attachment Image from ApptiveGrid. This includes loading logic for thumbnails. It also allows to only load thumbnails when the full size image is not needed.
AttachmentImage(
attachment: attachment,
loadingWidget: WidgetToShowWhileLoading(),
// Only load small and large thumbnail
loadUntil: LoadUntil.large,
),
Configuration Change Notifier #
Useful to provide different Options based on differen ApptiveGridEnviornments.
_configurationNotifier = ConfigurationChangeNotifier<dynamic>(
environment: widget.initialEnvironment,
configurations: {
ApptiveGridEnvironment.alpha: ApptiveGridEnvironment.alpha,
ApptiveGridEnvironment.beta: ApptiveGridEnvironment.beta,
ApptiveGridEnvironment.production: ApptiveGridEnvironment.production,
},
);
...
return ChangeNotifierProvider.value(
value: _configurationNotifier,
child: child,
);
Environment Switcher #
A widget which takes Info from a ConfigurationChangeNotifier and displays a dropdown menu button to switch between available Environments.
ListTile(
title: Text('Environment'),
trailing: EnvironmentSwitcher(
onChangeEnvironment: (environment) async {
await _logout();
},
),
),
Stage Banner #
A combination of a ChangeNotifier to keep track of the setting and a Banner Widget to show the current Environment as a Banner. Note this will never show a banner on production only on beta and alpha.
ChangeNotifierProvider(
create: (_) => EnableBannerNotifier.create(() async {
final prefs = await SharedPreferences.getInstance();
return prefs.getBool(PreferencesKeys.enableBanner) ?? true;
}),
child: child,
);
...
/// Further down the widget tree
return StageBanner(
child: child,
);
FormalGermanApptiveGridUserManagementTranslation #
Formal German Translations for ApptiveGridUserManagementTranslations to use this instead of the default Strings that address the user with 'DU' add this to the ApptiveGridUserManagement Widget like this
ApptiveGridUserManagement(
customTranslations: {
const Locale.fromSubtags(languageCode: 'de'):
FormalGermanApptiveGridUserManagementTranslation(),
},
...
DataWidget #
Show a DataEntity in a format closer to the ApptiveGrid Web UI.
const DataWidget(
data: dataEntity,
),
ProfilePicture #
Show a ProfilePicture for an ApptiveGrid User and show the initials if no image is available.
const ProfilePicture({
userId: 'userId',
name: 'Christian Denker',
})
InvitationDialog #
Show a Dialog to invite someone to a Space
showSpaceInvitationDialog(context: context, space: space);
The available Roles and Invitation Method (Invitation, Direct Add) can be configured as well as all Strings. For more Details check the code Documentation
Perform ApptiveLink for ApptiveGrid Objects #
An extension method to skip having to write custom response parsers when performing ApptiveLink if the result is an ApptiveGrid Object or a list of those.
final client = ApptiveGridClient();
final grids = await client.performApptiveLinkForApptiveGridObject<List<Grid>>(link: gridLink);
can be used instead of
final client = ApptiveGridClient();
final grids = await client.performApptiveLink<List<Grid>>(
link: gridLink,
parseResponse: (response) async {
final jsonList = (jsonDecode(response.body) as Map)['items'] as List;
return jsonList.map((e) => Grid.fromJson(e)).toList();
},
);