native_widgets 1.3.7+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 58

Flutter Community: native_widgets

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.

Online Demo: https://fluttercommunity.github.io/native_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!

CHANGELOG #

1.3.7 #

  • intl: ">=0.15.0 <1.0.0"

1.3.6 #

  • Fixing type
  • Bumping version

1.3.5 #

  • Bump Version

1.3.3 #

  • Fix for Sticky Header

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/lib/main.dart

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

import 'screens/page_1.dart';
import 'screens/page_2.dart';
import 'screens/page_3.dart';
import 'screens/page_4.dart';
import 'dart:io' show Platform;
import 'package:flutter/foundation.dart';

// The existing imports
// !! Keep your existing impots here !!

/// main is entry point of Flutter application
void main() {
  // Desktop platforms aren't a valid platform.
 if (!kIsWeb) _setTargetPlatformForDesktop();
  return runApp(MyApp());
}

/// If the current platform is desktop, override the default platform to
/// a supported platform (iOS for macOS, Android for Linux and Windows).
/// Otherwise, do nothing.
void _setTargetPlatformForDesktop() {
  TargetPlatform targetPlatform;
  if (Platform.isMacOS) {
    targetPlatform = TargetPlatform.iOS;
  } else if (Platform.isLinux || Platform.isWindows) {
    targetPlatform = TargetPlatform.android;
  }
  if (targetPlatform != null) {
    debugDefaultTargetPlatformOverride = targetPlatform;
  }
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      localizationsDelegates: <LocalizationsDelegate<dynamic>>[
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
      ],
      supportedLocales: const <Locale>[
        Locale('en', 'US'),
        Locale('he', 'IL'),
      ],
      home: NativeAppLook(),
    );
  }
}

class NativeAppLook extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return NativeTabScaffold(
      tabs: [
        BottomNavigationBarItem(
          icon: Icon(Icons.info),
          title: Text("Info"),
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.search),
          title: Text("Search"),
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.list),
          title: Text("Table"),
        ),
      ],
      pages: <NativeTabView>[
        NativeTabView(
          title: "Input Form",
          child: Page1(),
        ),
        NativeTabView(
          title: "Nav Demo",
          child: Page2(),
        ),
        NativeTabView(
          title: "Table View",
          child: Page3(),
        ),
      ],
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  native_widgets: ^1.3.7+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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]
87
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Mar 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Analysis issues and suggestions

Fix dependencies in pubspec.yaml.

Running flutter pub upgrade failed with the following output:

ERR: Because native_widgets depends on flutter_localizations any from sdk which depends on intl 0.16.0, intl 0.16.0 is required.
 So, because native_widgets depends on intl ^0.16.1, version solving failed.

Health suggestions

Format lib/app_bar/search_bar.dart.

Run flutter format to format lib/app_bar/search_bar.dart.

Format lib/common/search/native_search.dart.

Run flutter format to format lib/common/search/native_search.dart.

Format lib/switch/switch.dart.

Run flutter format to format lib/switch/switch.dart.

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

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

Dependencies were not resolved.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0