empathetech_flutter_ui 5.0.0 copy "empathetech_flutter_ui: ^5.0.0" to clipboard
empathetech_flutter_ui: ^5.0.0 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
  • Responsive design
  • Screen reader support
    • All custom Widgets and the example app have been manually verified with TalkBack and VoiceOver
  • 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 full control over theme colors, fonts, styling, spacing, and images to their users.
  • 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.


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! The example app is full of comments to help you on your path.

Here are some (unaffiliated) videos you might also find helpful.

Usage #

TL;DR #

--- Required ---

  1. Initialize EzConfig in void main()
  2. Use EzAppProvider to build a PlatformApp
    - OR use ezThemeData in any existing provider/app
    - OR use EzConfig to build a custom ThemeData


--- Recommended ---

  1. Copy all example app settings screens to your project
  2. Enjoy

Setup #

Step 1 #

Initialize EzConfig in void main()

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final SharedPreferences prefs = await SharedPreferences.getInstance();

  EzConfig(
    // Paths to any locally stored images the app uses
    assetPaths: {},

    preferences: prefs,

    // Your brand colors, custom styling, etc
    customDefaults: {},
  );
  
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.landscapeLeft,
    DeviceOrientation.landscapeRight,
  ]);

  runApp(const EFUIExample());
}

How it works

EzConfig gathers and stores the app's theme data.

EzConfig starts with Empathetech's config, then merges in your customDefaults, and 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 #

In main.dart, use an EzAppProvider to build your PlatformApp

class EFUIExample extends StatelessWidget {
  final Key? key;

  const EFUIExample({this.key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return EzAppProvider(
      app: PlatformApp.router(
        debugShowCheckedModeBanner: false,

        // Language handlers
        localizationsDelegates: {
          LocaleNamesLocalizationsDelegate(),
          ...EFUILang.localizationsDelegates,
        },

        // Supported languages
        supportedLocales: EFUILang.supportedLocales,

        // Current language
        locale: EzConfig.getLocale(),

        title: efuiL,
        routerConfig: _router,
      ),
    );
  }
}

How it works

EzAppProvider is a PlatformProvider wrapper that uses ezThemeData by default.

ezThemeData sets up the dynamic color scheme, a readable 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!

The example app is built to be a drop-in solution for your apps' settings.

Copy/paste all the screen files and routes from main.dart (below)

// Initialize a path based router for web-enabled apps
// Or any other app that requires deep linking
// https://docs.flutter.dev/ui/navigation/deep-linking
final GoRouter _router = GoRouter(
  initialLocation: homeRoute,
  routes: <RouteBase>[
    GoRoute(
      name: homeRoute,
      path: homeRoute,
      builder: (BuildContext context, GoRouterState state) {
        return const HomeScreen();
      },
      routes: <RouteBase>[
        GoRoute(
          name: styleSettingsRoute,
          path: styleSettingsRoute,
          builder: (BuildContext context, GoRouterState state) {
            return const StyleSettingsScreen();
          },
        ),
        GoRoute(
          name: colorSettingsRoute,
          path: colorSettingsRoute,
          builder: (BuildContext context, GoRouterState state) {
            return const ColorSettingsScreen();
          },
        ),
        GoRoute(
          name: imageSettingsRoute,
          path: imageSettingsRoute,
          builder: (BuildContext context, GoRouterState state) {
            return const ImageSettingsScreen();
          },
        ),
      ],
    ),
  ],
);

Rename the (just copied) Home.dart file and HomeScreen() class to something more appropriate; like Settings.dart and SettingsScreen(). Then, create a link to SettingsScreen in your app, and, boom!

It's that Ez!

How it works

The example app's screens neatly organize all the custom Widgets that enable EFUI's user customization!

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!

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 #

From the example #

Platform availability #

Android iOS
Home page on Android Home page on iOS
Linux MacOS Windows
Home page on Linux Home page on macOS Home page on Windows
Web
Home page on Web

User customization #

Core settings example Image settings example Update image preview
Color settings example Color picker preview Style settings example
Font picker preview Margin setting preview Padding setting preview

Internationalization #

Core settings in Spanish Image settings in Spanish Color settings in Spanish Style settings in Spanish

Screen reader semantics are also internationalized!

Contributing #

The vibes! #

If you build something with EFUI, let us know! We'd love to have a third-party live section

Time #

Please reach out to the community contact about becoming a contributor. There's never a shortage of ideas, only time!

More languages #

If you speak English and a currently unsupported language, please reach out! The more the merrier.

Money #

Many thanks for any and all donations!

Paypal #

paypal

Venmo #

Cash App #

Patreon #

Buy Me a Coffee #

Ko-fi #

License #

GNU GPLv3

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...