platform_widgets 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 66

Platform Widgets #

Flutter Dart

A Flutter plugin for Platform specific widgets.

Usage #

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

Available Widgets #

  • PlatformApp returns CupertinoApp when iOS and MaterialApp when Android.

  • PlatformTheme's ios property returns CupertinoThemeData and android property returns ThemeData.

  • PlatformScaffold returns CupertinoPageScaffold when iOS and Scaffold when Android.

  • PlatformButton returns CupertinoButton when iOS and FlatButton when Android.

  • PlatformBar returns NavigationBar when iOS and AppBar when Android.

[0.0.1] - 16/01/2020 #

  • Initial structure
  • PlatformApp and PlatformScaffold Widgets

[0.1.0] - 20/01/2020 #

  • App to exemplify plugin
  • PlatformButton and PlatformBar Widgets

[0.1.1] - 21/01/2020 #

  • Added PlatformTheme
  • Fixed formatting issues
  • Some analysis error resolved

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:platform_widgets/base/platform_app.dart';
import 'package:platform_widgets/platform_scaffold.dart';
import 'package:platform_widgets/platform_button.dart';
import 'package:platform_widgets/platform_bar.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return PlatformApp(
      home: PlatformScaffold(
        appbar: PlatformBar(
          middle: Text('Example App'),
        ),
        child: Center(
          child: PlatformButton(
            child: Text('Example Button'),
            onPressed: () => print('On Button Pressed'),
          ),
        )
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  platform_widgets: ^0.1.1

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:platform_widgets/base/platform_app.dart';
import 'package:platform_widgets/base/platform_theme.dart';
import 'package:platform_widgets/base/platform_widget.dart';
import 'package:platform_widgets/platform_bar.dart';
import 'package:platform_widgets/platform_button.dart';
import 'package:platform_widgets/platform_scaffold.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Apr 7, 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

Health suggestions

Format lib/base/platform_app.dart.

Run flutter format to format lib/base/platform_app.dart.

Format lib/platform_bar.dart.

Run flutter format to format lib/platform_bar.dart.

Format lib/platform_button.dart.

Run flutter format to format lib/platform_button.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test