empathetech_flutter_ui 7.0.0-dev.2 empathetech_flutter_ui: ^7.0.0-dev.2 copied to clipboard
Build apps for anyone. EFUI makes building user accessible and customizable apps Ez. So everyone can enjoy your great idea!
Empathetech Flutter UI
Build apps for anyone #
EFUI is a starter kit for building apps with a strong foundation in every pillar of digital accessibility:
- Platform availability
- Thanks to Flutter, EFUI is fully cross platform! EFUI can build apps for Android, iOS, Linux, MacOS, Windows and Web!
- Thanks to integration with Flutter Platform Widgets, apps built with EFUI will gracefully adapt to Cupertino (Apple) and Material (Android and beyond) styling
- Thanks to Flutter, EFUI is fully cross platform! EFUI can build apps for Android, iOS, Linux, MacOS, Windows and Web!
- Responsive design
- Here's the definition
- Checkout the demo to see it in action
- Screen reader support
- User customization
- The only way to be truly accessible for ALL customers is to empower them with the freedom of choice.
- EFUI enables developers to expose control over app theme, language, typography, layout, color scheme and images to their users.
- The only way to be truly accessible for ALL customers is to empower them with the freedom of choice.
- Internationalization
- All of EFUI's external text has been translated to Spanish. With the infrastructure for internationalization laid out, the only work left are the translations themselves.
- Moral fiber moment: Remember that LLMs are a tool for acceleration. But, there's a lot more to winning a race than acceleration. If your translations are generated, disclose that. EFUI's translations started with A.H.I. and ended with H.I.
- All of EFUI's external text has been translated to Spanish. With the infrastructure for internationalization laid out, the only work left are the translations themselves.
When built with EFUI, apps can truly reach any audience. Let's make the internet a more accessible place together!
Table of Contents #
Installation #
In your app's base directory, run
flutter pub add empathetech_flutter_ui
And add the following import to any files that use EFUI's library
import 'package:empathetech_flutter_ui/empathetech_flutter_ui.dart';
Beginner tutorials #
If you're new to Flutter: welcome! EFUI is full of comments to help you on your path.
Here are some (unaffiliated) videos you might also find helpful.
Usage #
TL;DR #
--- Required ---
- Initialize EzConfig in
void main()
- Use EzAppProvider to build a PlatformApp
- OR use ezThemeData in any existing provider/app
- OR useEzConfig
to build a customThemeData
--- Recommended ---
3. Copy the settings sandbox to your project
4. Enjoy
Setup #
Step 1 #
Initialize EzConfig in void main()
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final SharedPreferences prefs = await SharedPreferences.getInstance();
EzConfig.init(
// Paths to any locally stored images the app uses
assetPaths: {},
preferences: prefs,
// Your brand colors, custom styling, etc
defaults: empathetechConfig, // is an optional starter
);
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]);
runApp(const YourApp());
}
How it works
EzConfig
gathers and stores the app's theme data, merging your customDefaults
with the user's saved preferences.
Once gathered, EzConfig
stores the data in a Singleton instance for efficient access. EzConfig
has a series of getter and setter methods for safe interactions with the theme data.
Step 2 #
Use EzAppProvider to build a PlatformApp
class YourApp extends StatelessWidget {
final Key? key;
const YourApp({super.key});
@override
Widget build(BuildContext context) {
return EzAppProvider(
app: PlatformApp.router(
debugShowCheckedModeBanner: false,
// Language handlers
localizationsDelegates: {
LocaleNamesLocalizationsDelegate(),
...EFUILang.localizationsDelegates,
...YourAppLang.localizationsDelegates,
},
// Supported languages
supportedLocales: {
...EFUILang.supportedLocales,
...YourAppLang.supportedLocales,
},
// Current language
locale: EzConfig.getLocale(),
title: YourAppTitle,
routerConfig: _yourAppRouter,
),
);
}
}
How it works
EzAppProvider
is a PlatformProvider wrapper that uses ezThemeData by default.
ezThemeData
sets up the dynamic color scheme and text theme, and updates some touch points to be higher contrast by default.
You are more than welcome to use your own app/app provider with ezThemeData
for the same effect.
Or, you can even build your own fully custom base theme with EzConfig
data.
Step 3 #
Copy the settings sandbox to your project
The example app is built to be a drop-in solution for your apps' settings.
Copy/paste all the screen files and make paths to them in your apps' routes.
Example GoRouter
setup...
/// A path based router for web-enabled apps
final GoRouter _yourAppRouter = GoRouter(
initialLocation: homePath,
routes: <RouteBase>[
GoRoute(
path: homePath,
builder: (BuildContext context, GoRouterState state) {
return const HomeScreen();
},
routes: routes:<RouteBase>[
/// ...all of your pre/soon to be existing Routes
GoRoute(
path: settingsRoute,
builder: (BuildContext context, GoRouterState state) {
return const SettingsScreen();
},
routes:<RouteBase>[
GoRoute(
path: textSettingsPath,
builder: (BuildContext context, GoRouterState state) {
return const TextSettingsScreen();
},
),
GoRoute(
path: textSettingsPath,
builder: (BuildContext context, GoRouterState state) {
return const TextSettingsScreen();
},
),
GoRoute(
path: layoutSettingsPath,
builder: (BuildContext context, GoRouterState state) {
return const LayoutSettingsScreen();
},
),
GoRoute(
path: colorSettingsPath,
builder: (BuildContext context, GoRouterState state) {
return const ColorSettingsScreen();
},
),
GoRoute(
path: imageSettingsPath,
builder: (BuildContext context, GoRouterState state) {
return const ImageSettingsScreen();
},
),
],
),
],
),
],
);
And boom!
It's that Ez!
NOTE: This code snippets assumes you renamed the (just copied) Home.dart
file and HomeScreen()
class to Settings.dart
and SettingsScreen()
How it works
The example app's screens neatly organize all the custom Widgets that enable EFUI's user customization!
- EzDominantHandSwitch: A toggle for switching common touch points to benefit lefties.
- EzThemeModeSwitch: A toggle for switching between light, dark, and system theme.
- EzLocaleSetting: A menu for updating the app's language.
- TextSettings: A collection of custom Widgets for controlling an app's TextStyles
- EzLayoutSetting: A dynamic slider Widget, with live preview(s), for updating the themes layout (margin, padding, and spacing).
- EzColorSetting: A color picker for updating each entry in an app's ColorScheme.
- EzImageSetting: An image uploader for updating app assets.
- EzResetButton: A customizable button for resetting groups of preferences.
By default, every base theme setting is exposed. Additional keys provided to customDefaults
can be updated with these Widgets as well!
If there are any theme values you wish to stay constant, simply remove the paired setting Widget(s).
Step 4 #
Enjoy!
The pillars of platform availability and user customization are "set it and forget it"; bar any external libraries that break things.
But, as you grow your apps, the other pillars require continuous development.
Thankfully, EFUI's got you covered there too!
- Responsive design: Widgets that aid in building responsive UI/UXs
- Screen reader support: Widgets with streamlined semantics
But, this should be plenty to get you started (and avoid overload). Once you're feeling settled, the code has been organized to aid in exploration!
Demo #
Live #
Contributing #
The vibes! #
If you build something with EFUI, let us know! We'd love to have a third-party Demo section.
Time #
Please reach out to the community contact about becoming a contributor. There's never a shortage of ideas, only time!
Translations #
If you speak English and a currently unsupported language, please reach out! The more the merrier.
OR: If you speak English and a currently supported language, and see something wrong, please reach out! It takes a village.
Money #
Many thanks for any and all donations!
Paypal #
Venmo #
Cash App #
Patreon #
Buy Me a Coffee #
Ko-fi #
License #
Credits #
Translations #
Thank you to M Ramirez for verifying EFUI's Spanish translations!
Flutter OSS #
EFUI wouldn't be as awesome as it is without these other awesome community projects...
And, of course, all the awesome Flutter devs...