native_widgets 1.3.2

Buy Me A Coffee Donate

Native Widgets #

pub package

A Flutter plugin to show the correct widgets for iOS and Android.

Avoid duplicating code and just write once for supported widgets.

Android will use Material Design and iOS will use Cupertino style widgets.

Usage #

To use this plugin, add native_widgets as a dependency in your pubspec.yaml file.

Look at the example for various ways to use this plugin!

1.3.2 - 05.0629.2019 #

  • Upgrading Packages
  • Working with Flutter dev channel

1.2.1 - 05.06.2019 #

  • Upgrading Packages

1.3.0 - 05.03.2019 #

  • Adding Support for Desktop
  • Updating Example
  • Adding Desktop Targets to Example

1.2.0 - 04.06.2019 #

  • Making Example Desktop Aware

[1.0.1]

  • Added current index to NativeScaffold's PlatformNavBar.
  • Added automaticallyImplyLeading to allow hidden leading element in AppBar.
  • Thank you to @amadejkastelic for the PR

[1.0.0] - Major Update

  • Refactored Library to use Platfrom Widgets plugin in the backend
  • Added Layout (Mobile, Tablet, Desktop)
  • Added Detailed Example
  • Added Folder Structure to Library for Easy Documentaion
  • Added Cupertino TableViewController, Cell and Search Bar
  • Updated Picker
  • Added Toolbar
  • Added App Bar
  • Added Scaffold
  • Added Text Button
  • Added Icon Button
  • Added Routing
  • Added Segmented Select
  • Updated Bottom Tabs
  • Added Top Navigation
  • Added Main App
  • Added Text Label
  • Added Search Widget
  • Updated Switch
  • Added Confirmation Dialog
  • Updated iOS Dialog with Actions

[0.1.2] - Updated Example

  • Updated Example and New Dart Support

[0.1.1] - Bug Fixes and Breaking Changes

  • Native button will now default to 16.0 padding internal

[0.1.0] - Bug Fixes and Breaking Changes

  • Native button will now use Material Button on Android instead of raised button
  • You can specify android specific options and cupertino ios options
  • There is now internal and external paddign for buttons

[0.0.4] - Bug Fixes

  • Bug Fix for Center Loading Indicator

[0.0.3] - Adding Components

  • Bug Fix for App Bar

[0.0.2] - Adding Components

  • Added App Bar and optional text for Loading Indicator

[0.0.1] - Adding Components

  • Added Button, Switch, Dialog, Loading Indicator, and Tab Bar

example/README.md

native_widgets #

import 'package:flutter/material.dart';
import 'package:native_widgets/native_widgets.dart';

import '../utils/pop_up.dart';

class Page1 extends StatefulWidget {
  @override
  _Page1State createState() => _Page1State();
}

class _Page1State extends State<Page1> {
  bool _active = false;
  int _selected = 0;
  String _value = "Apple";
  bool _switch = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: NativeAppBar(
        leading: Container(
          padding: EdgeInsets.only(top: 10.0),
          child: NativeTextButton(
            label: "Cancel",
            onPressed: () {
              FocusScope.of(context).requestFocus(new FocusNode());
            },
          ),
        ),
        title: const Text("Input Form"),
        actions: <Widget>[
          Container(
            padding: EdgeInsets.only(top: 10.0),
            child: NativeTextButton(
              label: "Save",
              style: TextStyle(fontWeight: FontWeight.bold),
              onPressed: () {
                FocusScope.of(context).requestFocus(new FocusNode());
              },
            ),
          ),
        ],
      ),
      body: SingleChildScrollView(
        child: ListBody(
          children: <Widget>[
            ListTile(
              title: const Text("Loading Indicator..."),
              trailing: NativeLoadingIndicator(),
            ),
            ListTile(
              title: const Text("Switch"),
              trailing: NativeSwitch(
                value: _active,
                onChanged: (bool value) => setState(() => _active = value),
              ),
            ),
            Container(height: 20.0),
            NativeGroupSelect<int>(
              groupValue: _selected,
              children: <int, Widget>{
                0: Text('Midnight'),
                1: Text('Viridian'),
                2: Text('Cerulean'),
              },
              onValueChanged: (int value) {
                setState(() {
                  _selected = value;
                });
              },
            ),
            NativeSelection(
              value: _value,
              items: [
                "Apple",
                "Orange",
                "Pineapple",
                "Cherry",
              ],
              onChanged: (String value) {
                setState(() {
                  _value = value;
                });
              },
            ),
            NativeListTile(
              title: const Text("Power Saver"),
              // subtitle: Text("Puts Device into Low Power Mode"),
              // hideLeadingIcon: true,
              ios: CupertinoListTileData(
                style: CupertinoCellStyle.basic,
              ),
              trailing: <Widget>[
                NativeSwitch(
                    value: _switch,
                    onChanged: (bool value) {
                      setState(() {
                        _switch = value;
                      });
                    }),
              ],
            ),
            Container(
              padding: const EdgeInsets.all(20.0),
              child: NativeButton(
                child: const Text("Submit"),
                // padding: const EdgeInsets.all(20.0),
                color: Colors.blue,
                onPressed: () => showAlertPopup(context,
                    title: "Native Dialog", detail: "Button Submitted!"),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  native_widgets: ^1.3.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:native_widgets/native_widgets.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
90
Health:
Code health derived from static analysis. [more]
89
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
90
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Fix lib/utils/ios_search_bar.dart. (-5.48 points)

Analysis of lib/utils/ios_search_bar.dart reported 1 warning, 1 hint:

line 157 col 38: The parameter 'backgroundCursorColor' is required.

line 5 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: IOSSearchBar._inputKey

Fix lib/input/date_picker.dart. (-1 points)

Analysis of lib/input/date_picker.dart reported 2 hints:

line 12 col 12: This function has a return type of 'Widget', but doesn't end with a return statement.

line 13 col 16: This function has a return type of 'Widget', but doesn't end with a return statement.

Fix lib/scaffold/list_view_scaffold.dart. (-1 points)

Analysis of lib/scaffold/list_view_scaffold.dart reported 2 hints:

line 131 col 5: The type parameter 'children' is annotated with @required but only named parameters without default value can be annotated with it.

line 158 col 27: The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Fix additional 10 files with analysis or formatting issues. (-4 points)

Additional issues in the following files:

  • lib/scaffold/tab_scaffold.dart (2 hints)
  • lib/common/list_tile.dart (1 hint)
  • lib/common/routing.dart (1 hint)
  • lib/common/text.dart (1 hint)
  • lib/dialog/alert_dialog.dart (1 hint)
  • lib/picker/selection.dart (1 hint)
  • lib/scaffold/ios_controllers/table_view_controller/controller.dart (1 hint)
  • lib/app_bar/search_bar.dart (Run flutter format to format lib/app_bar/search_bar.dart.)
  • lib/common/search/native_search.dart (Run flutter format to format lib/common/search/native_search.dart.)
  • lib/switch/switch.dart (Run flutter format to format lib/switch/switch.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (flutter_platform_widgets).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
flutter 0.0.0
flutter_list_drag_and_drop ^0.1.6 0.1.6
flutter_localizations 0.0.0
flutter_platform_widgets ^0.10.0 0.10.0 0.12.0
flutter_slidable ^0.5.3 0.5.3
flutter_sticky_header ^0.4.0 0.4.0
intl ^0.15.8 0.15.8
uuid ^2.0.1 2.0.2
Transitive dependencies
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.2
cupertino_icons 0.1.2
meta 1.1.6 1.1.7
path 1.6.2 1.6.4
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test