native_widgets 1.0.0+2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 87

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.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.0.0+2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages 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';
  
Version Uploaded Documentation Archive
1.0.0+2 Feb 7, 2019 Go to the documentation of native_widgets 1.0.0+2 Download native_widgets 1.0.0+2 archive
1.0.0+1 Feb 7, 2019 Go to the documentation of native_widgets 1.0.0+1 Download native_widgets 1.0.0+1 archive
0.1.1+1 Jul 27, 2018 Go to the documentation of native_widgets 0.1.1+1 Download native_widgets 0.1.1+1 archive
0.1.1 Jul 27, 2018 Go to the documentation of native_widgets 0.1.1 Download native_widgets 0.1.1 archive
0.1.0 Jul 27, 2018 Go to the documentation of native_widgets 0.1.0 Download native_widgets 0.1.0 archive
0.0.4 Jul 27, 2018 Go to the documentation of native_widgets 0.0.4 Download native_widgets 0.0.4 archive
0.0.3 Jul 25, 2018 Go to the documentation of native_widgets 0.0.3 Download native_widgets 0.0.3 archive
0.0.2 Jul 25, 2018 Go to the documentation of native_widgets 0.0.2 Download native_widgets 0.0.2 archive
0.0.1 Jul 10, 2018 Go to the documentation of native_widgets 0.0.1 Download native_widgets 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
91
Health:
Code health derived from static analysis. [more]
92
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.13
  • Flutter: 1.2.0

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/scaffold/tab_scaffold.dart. (-1 points)

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

line 27 col 15: Dead code.

line 27 col 15: Avoid empty statements.

Fix lib/common/list_tile.dart. (-0.50 points)

Analysis of lib/common/list_tile.dart reported 1 hint:

line 3 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: NativeListTile.onTap, NativeListTile.onLongPressed, NativeListTile.selected, NativeListTile.editing

Fix additional 8 files with analysis or formatting issues. (-1.50 points)

Additional issues in the following files:

  • lib/common/routing.dart (1 hint)
  • lib/picker/selection.dart (1 hint)
  • lib/scaffold/list_view_scaffold.dart (1 hint)
  • lib/common/common_tiles/phone_tile.dart (Run flutter format to format lib/common/common_tiles/phone_tile.dart.)
  • lib/common/widget.dart (Run flutter format to format lib/common/widget.dart.)
  • lib/input/date_picker.dart (Run flutter format to format lib/input/date_picker.dart.)
  • lib/scaffold/ios_controllers/navigation_controller.dart (Run flutter format to format lib/scaffold/ios_controllers/navigation_controller.dart.)
  • lib/utils/platform_switch.dart (Run flutter format to format lib/utils/platform_switch.dart.)

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

exitCode: 255 stdout: parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/scaffold/ios_controllers/master_detail_controller/controller.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/scaffold/ios_controllers/navigation_controller.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/scaffold/ios_controllers/table_view_controller/cell.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/scaffold/ios_controllers/table_view_controller/controller.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/app_bar/cupertino/search.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/native_widgets.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/utils/data_table.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/utils/ios_search_bar.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/common/search/cupertino_search_bar.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/common/search/material_search_bar.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/common/common_tiles/basic_tile.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/common/common_tiles/base_tile.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/common/common_tiles/phone_tile.dart... parsing /tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/common/common_tiles/avatar_title.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/collection/collection.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/developer/developer.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/internal/internal.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/io/io.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/isolate/isolate.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/async/async.dart... [...] parsing /tmp/pub-cache-dirMPJZOR/hosted/pub.dartlang.org/collection-1.14.11/lib/wrappers.dart... parsing /tmp/pub-cache-dirMPJZOR/hosted/pub.dartlang.org/collection-1.14.11/lib/iterable_zip.dart... parsing /tmp/pub-cache-dirMPJZOR/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math.dart... parsing /tmp/pub-cache-dirMPJZOR/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_geometry.dart... parsing /tmp/pub-cache-dirMPJZOR/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_lists.dart... parsing /tmp/pub-cache-dirMPJZOR/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_operations.dart... Initialized dartdoc with 474 libraries in 84.2 seconds documenting native_widgets Generating docs for library avatar_title from package:native_widgets/common/common_tiles/avatar_title.dart... Generating docs for library base_tile from package:native_widgets/common/common_tiles/base_tile.dart... Generating docs for library basic_tile from package:native_widgets/common/common_tiles/basic_tile.dart... Generating docs for library cell from package:native_widgets/scaffold/ios_controllers/table_view_controller/cell.dart... Generating docs for library controller from package:native_widgets/scaffold/ios_controllers/master_detail_controller/controller.dart... Generating docs for library controller from package:native_widgets/scaffold/ios_controllers/table_view_controller/controller.dart... Generating docs for library cupertino_search_bar from package:native_widgets/common/search/cupertino_search_bar.dart... Generating docs for library data_table from package:native_widgets/utils/data_table.dart... Generating docs for library ios_search_bar from package:native_widgets/utils/ios_search_bar.dart... Generating docs for library material_search_bar from package:native_widgets/common/search/material_search_bar.dart... Generating docs for library native_widgets from package:native_widgets/native_widgets.dart... Generating docs for library navigation_controller from package:native_widgets/scaffold/ios_controllers/navigation_controller.dart... stderr: Documenting native_widgets... warning: unresolved doc reference [new DataRow.byIndex] from data_table.DessertDataSource.getRow: (file:///tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/utils/data_table.dart:95:11) in documentation inherited from data_table_source.DataTableSource.getRow: (file:///flutter/packages/flutter/lib/src/material/data_table_source.dart:36:11) warning: native_widgets has no library level documentation comments, from native_widgets: (file:///tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/native_widgets.dart:1:8) warning: unresolved doc reference [Scaffold] from native_widgets.NativeAppBar.preferredSize: (file:///tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/app_bar/app_bar.dart:36:14) in documentation inherited from preferred_size.PreferredSizeWidget.preferredSize: (file:///flutter/packages/flutter/lib/src/widgets/preferred_size.dart:28:12) warning: unresolved doc reference [Scaffold] from native_widgets.NativeSearchAppBar.preferredSize: (file:///tmp/pub-dartlang-dartdocSHRWLC/pkg/lib/app_bar/search_bar.dart:32:14) in documentation inherited from preferred_size.PreferredSizeWidget.preferredSize: (file:///flutter/packages/flutter/lib/src/widgets/preferred_size.dart:28:12) Unhandled exception: RangeError (start): Invalid value: Only valid value is 0: 1 #0 _StringBase.indexOf (dart:core/runtime/libstring_patch.dart:334:7) #1 String.indexOf (dart:core/runtime/libstring_patch.dart:1024:18) #2 _createLineNumbersMap (package:dartdoc/src/line_number_cache.dart:30:23) #3 LineNumberCache.lineAndColumn.<anonymous closure> (package:dartdoc/src/line_number_cache.dart:47:21) #4 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:281:23) #5 LineNumberCache.lineAndColumn (package:dartdoc/src/line_number_cache.dart:46:32) #6 ModelElement.lineAndColumn (package:dartdoc/src/model.dart:3499:40) #7 new SourceLinker.fromElement (package:dartdoc/src/source_linker.dart:88:27) #8 ModelElement.sourceHref (package:dartdoc/src/model.dart:3222:25) #9 ModelElement.hasSourceHref (package:dartdoc/src/model.dart:3219:29) #10 _LocalInstanceMirror._invokeGetter (dart:mirrors/runtime/libmirrors_impl.dart:329:76) #11 _LocalInstanceMirror.getField (dart:mirrors/runtime/libmirrors_impl.dart:296:20) #12 Renderer._getNamedProperty (package:mustache/src/renderer.dart:245:29) #13 Renderer.resolveValue (package:mustache/src/renderer.dart:212:16) #14 Renderer._renderSection (package:mustache/src/renderer.dart:120:17) #15 Renderer.visitSection (package:mustache/src/renderer.dart:115:7) #16 SectionNode.accept (package:mustache/src/node.dart:63:43) #17 Renderer.render.<anonymous closure> (package:mustache/src/renderer.dart:58:30) #18 List.forEach (dart:core/runtime/libgrowable_array.dart:277:8) #19 Renderer.render (package:mustache/src/renderer.dart:58:13) #20 Renderer.visitPartial (package:mustache/src/renderer.dart:195:16) #21 PartialNode.accept (package:mustache/src/node.dart:81:43) #22 SectionNode.visitChildren.<anonymous closure> (package:mustache/src/node.dart:66:37) #23 List.forEach (dart:core/runtime/libgrowable_array.dart:277:8) #24 SectionNode.visitChildren (package:mustache/src/node.dart:66:14) #25 Renderer._renderWithValue (package:mustache/src/renderer.dart:184:10) #26 Renderer._renderSection (package:mustache/src/renderer.dart:144:7) #27 Renderer.visitSection (package:mustache/src/renderer.dart:115:7) #28 SectionNode.accept (package:mustache/src/node.dart:63:43) #29 Renderer.render.<anonymous closure> (package:mustache/src/renderer.dart:58:30) #30 List.forEach (dart:core/runtime/libgrowable_array.dart:277:8) #31 Renderer.render (package:mustache/src/renderer.dart:58:13) #32 Template.render (package:mustache/src/template.dart:40:14) #33 Template.renderString (package:mustache/src/template.dart:33:5) #34 HtmlGeneratorInstance._build (package:dartdoc/src/html/html_generator_instance.dart:381:31) #35 HtmlGeneratorInstance.generateLibrary (package:dartdoc/src/html/html_generator_instance.dart:269:5) #36 HtmlGeneratorInstance._generateDocs (package:dartdoc/src/html/html_generator_instance.dart:131:9) #37 HtmlGeneratorInstance.generate (package:dartdoc/src/html/html_generator_instance.dart:36:7) <asynchronous suspension> #38 HtmlGenerator.generate (package:dartdoc/src/html/html_generator.dart:108:23) <asynchronous suspension> #39 Dartdoc.generateDocsBase (package:dartdoc/dartdoc.dart:107:25) <asynchronous suspension> #40 Dartdoc.generateDocs (package:dartdoc/dartdoc.dart:134:43) <asynchronous suspension> #41 main (file:///project/pkg/pub_dartdoc/bin/pub_dartdoc.dart:27:17) <asynchronous suspension> #42 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:287:32) #43 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

Use constrained dependencies. (-20 points)

The pubspec.yaml contains 6 dependencies without version constraints. Specify version ranges for the following dependencies: flutter_list_drag_and_drop, flutter_platform_widgets, flutter_slidable, flutter_sticky_header, intl, uuid.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
flutter_list_drag_and_drop any 0.1.6
flutter_localizations 0.0.0
flutter_platform_widgets any 0.9.5
flutter_slidable any 0.4.9
flutter_sticky_header any 0.3.4
intl any 0.15.7
uuid any 2.0.0
Transitive dependencies
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
cupertino_icons 0.1.2
meta 1.1.6 1.1.7
path 1.6.2
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test