Introducing NativeBase Design System for Flutter

NativeBase + Flutter = :blue_heart:

NativeBase is a design system and universal component library for React and React Native . NativeBase has gained good popularity in the React and React Native community. We at GeekyAnts is experimenting to bring this same design system in Flutter. Hence we are releasing alpha version for flutter where we are asking Flutter Developers to try this package to build UI

NativeBase design system is build on top of Material design system and uses token base UI development.

This alpha version has minimum NativeBase widget


Installation Guide

Add package in your pubspec.ymal file as below

nativebase_flutter: 0.1.0-alpha.0

Now import the package into your main.dart file

import 'package:nativebase_flutter/nativebase_flutter.dart';

Now Inject NativeBaseProvider into the Widget tree like below

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: NativeBaseProvider(
        theme: appTheme,
        child: const NativeBaseExample(),
      ),
    );
  }

NativeBaseProvider needs to be on top of widget tree in order to resolve the tokens from the theme

NativeBase Tokens can also be access using NativeBaseProvider class of method as shown below.

NativeBaseProvider.of(context).component.heading.md.fontSize;
NativeBaseProvider.of(context).component.heading.md.letterSpacing;

The above code snippet will return token value of md fontSize and letterSpacing for Heading widget.

NOTE : NativeBase Token resolver engine resolves the token from the theme

NativeBase Design System Figma Kit


NativeBase components library with modular and accessible components makes it easier for designers and developers to design and build all components in their React and React Native applications.


Build with NativeBase

Code Snippet

 Widget card() {
    var img = 'https://tinyurl.com/4e7fty6f';
    return NBCard(
      m: '2',
      bgImage: img,
      color: 'cyan.700',
      child: Row(
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.min,
            children: [
              Row(
                children: const [
                  Box(
                    child: NBText(
                      text: "Today @ 9PM",
                      color: 'white',
                    ),
                  ),
                ],
              ),
              const Heading(
                text: "Let's talk about avatar!",
                color: 'white',
              ),
              const Box(
                alignment: 'center',
                mt: '3',
                color: 'cyan.400',
                p: '3',
                borderRadius: '6',
                child: NBText(
                  text: "Remind Me",
                  textTransform: 'capital',
                  color: 'white',
                ),
              ),
            ],
          ),
          Box(
            ml: '3',
            h: '90',
            w: '90',
            p: '10,
            borderWidth: '3',
            borderColor: 'white',
            bgImage: 'https://tinyurl.com/2vfrtp7d',
            borderRadius: 'full',
          ),
        ],
      ),
    );
  }

Libraries

theme/base/border
utils/border
models/utility-props-models/border_props
models/theme/borders_model
theme/components/box
components/primitives/box/box
models/components/box
theme/components/card
components/composite/card
models/components/card
models/theme/color_model
models/utility-props-models/color_props
theme/base/colors
models/theme/component_model
mixin/component-theme-resolver/component_theme_resolver
utils/components_enum
utils/constraints
mixin/style-instance-generator/container
models/theme/container_model
utils/edge_insets
models/utility-props-models/flexbox_props
models/components/heading
components/composite/heading
theme/components/heading
theme/components/index
models/utility-props-models/layout_props
builder/nativebase_builder
nativebase_flutter
components/nativebase_provider
models/theme/nativebase_theme_model
theme/base/opacity
models/theme/opacity_model
mixin/prop-resolver/prop_resolver
builder/props_builder
theme/base/radius
models/theme/radius_model
mixin/resolvers
utils/shadow
models/theme/shadow_model
models/utility-props-models/shadow_props
theme/base/shadows
theme/base/sizes
models/theme/sizes_model
theme/base/spaces
models/theme/spaces_model
mixin/style-instance-generator/style_instance_generator
models/utility-props-models/style_props
theme/styled_system
mixin/style-instance-generator/text
components/primitives/text/text
theme/theme
mixin/token-resolver/token_resolver
theme/base/typography
models/theme/typography_model
models/utility-props-models/typography_props