flutter_storyboard 0.1.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 54

Buy Me A Coffee Donate flutter_storyboard

storyboard #

A Flutter Debug tool to see and test all your screens at once.

Demo: https://rodydavis.github.io/storyboard/

screenshot

Examples #

Custom Lane Builder

Dynamic Screen Sizes

Material App Example

Widget Example

Multiple Custom Lanes Example

Getting Started #

Wrap your MaterialApp with Storyboard.

return StoryBoard.material(
      child: MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Flutter Storyboard Example',
        theme: ThemeData.light().copyWith(
          visualDensity: VisualDensity.adaptivePlatformDensity,
        ),
        darkTheme: ThemeData.dark().copyWith(
          visualDensity: VisualDensity.adaptivePlatformDensity,
        ),
        themeMode: ThemeMode.light,
        home: HomeScreen(),
        routes: {
          '/home': (_) => HomeScreen(),
          '/about': (_) => AboutScreen(),
          '/settings': (_) => SettingsScreen(),
        },
      ),
    );

Wrap your WidgetsApp with Storyboard.widgets(). Wrap your CupertinoApp with Storyboard.cupertino().

Custom Routes and Widgets #

You can add any number of custom widgets to the canvas, including custom routes. You can add dummy data to the constructors here as it will render all default values.

customScreens: [
  SettingsScreen(),
  AboutScreen(),
  CustomWidget(title: 'Dummy Data'),
],
customRoutes: [
  RouteSettings(name: '/about'),
],

Misc #

Now you can test all you screens with hot reload! You can also disable the widget at anytime by setting enabled to false. You will need to do a hot restart after you change this value.

0.1.6 #

  • Removing screenBuilder
  • Fixing #18

0.1.5 #

  • Adding Device Frame Option
  • Updated Example

0.1.4 #

  • Adding Pan/Scroll Events with TrackPad or Scroll Wheel

0.1.3 #

  • Fixes #15 Scale Reset
  • Adding Label for Children and SizedChildren
  • Adding sizedChildren based on CustomScreen
  • Fixing Storyboard Empty Children #14
  • Fixing #12 with picking up theme
  • Adding Examples

0.1.2 #

  • Adding Shadows for Dark Mode

0.1.1 #

  • Adding customLanes so you have total control
  • Added Example

0.1.0 #

  • Adding Custom Lane Builder
  • Adding Custom Item Builder
  • Adding Support for children instead of app
  • Bug Fixes
  • Changing Layout Engine
  • Reset now defaults to initial defaults
  • Adding CrossAxisCount for wrapping rows
  • Support for dynamic sizes
  • Adding multiple examples
  • Changing AppBar to PreferredSizeWidget

0.0.4 #

  • Adding Support for Route Arguments
  • Adding Shared Preferences Option
  • Fixing Bug with Android Back Button
  • Removing Callbacks
  • Fixing Initial Route Presentation
  • Updated Example

0.0.3 #

  • Added Locale Support
  • Added Title, onGenerateTitle
  • Added builder, shortcuts, actions
  • Bug Fixes

0.0.2 #

  • Adding onGenerateRoute, onUnknownRoute, initialRoute
  • Added Support for Custom Widgets/Screens
  • Updated Documentation
  • Updated Example
  • Added Support for Keyboard Controls for Zoom/Pan @Nash0x7E2
  • Added Constraint on Flutter v1.14.7
  • Fixed MediaQuery #1

0.0.1 #

  • Support for Named Routes and Home Field

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_storyboard/flutter_storyboard.dart';
import 'package:random_color/random_color.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return StoryBoard.material(
      enabled: true,
      usePreferences: true,
      crossAxisCount: 7,
      canPanAndScrollWithGesture: true,
      cupertinoDevice: CupertinoDevice.iPhone8,
      screenSize: Size(400, 700),
      customScreens: [
        for (var i = 0; i < 25; i++)
          _generateScreen(
            title: Text('Screen$i'),
            color: RandomColor(i + 25).randomColor(),
          ),
      ],
      customRoutes: [
        RouteSettings(name: '/about'),
        RouteSettings(name: '/counter'),
        RouteSettings(name: '/screen_2'),
        RouteSettings(name: '/screen_5'),
        RouteSettings(
          name: '/screen_8',
          arguments: <String, dynamic>{"id": 1234},
        ),
      ],
      child: MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Flutter Storyboard Example',
        theme: ThemeData.light().copyWith(
          visualDensity: VisualDensity.adaptivePlatformDensity,
        ),
        darkTheme: ThemeData.dark().copyWith(
          visualDensity: VisualDensity.adaptivePlatformDensity,
        ),
        themeMode: ThemeMode.light,
        // home: HomeScreen(),
        initialRoute: '/settings',
        routes: {
          '/': (_) => HomeScreen(),
          '/counter': (_) => CounterScreen(),
          '/settings': (_) => SettingsScreen(),
          for (var i = 0; i < 25; i++)
            '/screen_$i': (_) => _generateScreen(
                  title: Text('Screen$i'),
                  color: RandomColor(i).randomColor(),
                ),
        },
        onGenerateRoute: (settings) {
          return MaterialPageRoute(
            settings: settings,
            builder: (context) {
              if (settings.name == '/about') return AboutScreen();
              return UnknownScreen();
            },
          );
        },
      ),
    );
  }
}

Widget _generateScreen({
  Text title,
  FloatingActionButton fab,
  Color color,
}) {
  return Builder(
    builder: (context) {
      final Map<String, dynamic> args =
          ModalRoute.of(context).settings.arguments;
      return Scaffold(
        appBar: AppBar(title: title),
        backgroundColor: color,
        body: args == null ? null : Center(child: Text(args.toString())),
        floatingActionButton: fab,
      );
    },
  );
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final _size = MediaQuery.of(context).size;
    return Scaffold(
      appBar: AppBar(
        title: Text('Home Screen'),
      ),
      body: Center(
        child: Text(_size.toString()),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.info),
        onPressed: () {
          Navigator.of(context).push(MaterialPageRoute(
            builder: (_) => SettingsScreen(),
          ));
        },
      ),
    );
  }
}

class CounterScreen extends StatefulWidget {
  const CounterScreen({Key key}) : super(key: key);

  @override
  _CounterScreenState createState() => _CounterScreenState();
}

class _CounterScreenState extends State<CounterScreen> {
  int _counter = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Counter Example'),
      ),
      body: Center(
        child: Text('Counter: $_counter'),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {
          if (mounted)
            setState(() {
              _counter++;
            });
        },
      ),
    );
  }
}

class SettingsScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Settings'),
      ),
      backgroundColor: Colors.blue.shade300,
    );
  }
}

class AboutScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('About'),
      ),
      backgroundColor: Colors.purple.shade300,
    );
  }
}

class UnknownScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('404'),
      ),
      backgroundColor: Colors.red.shade300,
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_storyboard: ^0.1.6

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:flutter_storyboard/flutter_storyboard.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
70
Health:
Code health derived from static analysis. [more]
10
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
79
Overall:
Weighted score of the above. [more]
54
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Health issues and suggestions

Fix lib/src/nested_app.dart. (-89.99 points)

Analysis of lib/src/nested_app.dart failed with 8 errors, including:

line 120 col 13: The type 'Action' is declared with 0 type parameters, but 1 type arguments were given.

line 121 col 44: A value of type 'Map<LocalKey, Action Function()>' can't be returned from function 'actions' because it has a return type of 'Map<Type, Action>'.

line 122 col 43: A value of type 'Map<LocalKey, Action Function()>' can't be returned from function 'actions' because it has a return type of 'Map<Type, Action>'.

line 123 col 45: A value of type 'Map<LocalKey, Action Function()>' can't be returned from function 'actions' because it has a return type of 'Map<Type, Action>'.

line 179 col 9: The argument type 'Map<Type, Action>' can't be assigned to the parameter type 'Map<LocalKey, Action Function()>'.

Fix lib/src/storyboard.dart. (-1.49 points)

Analysis of lib/src/storyboard.dart reported 3 hints:

line 271 col 7: The value of the field '_row' isn't used.

line 478 col 23: The value of the field '_MAX_ZOOM' isn't used.

line 479 col 23: The value of the field '_MIN_ZOOM' isn't used.

Maintenance issues and suggestions

No valid SDK. (-20 points)

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

The package description is too short. (-1 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
device_frame ^0.1.1 0.1.2
flutter 0.0.0
shared_preferences ^0.5.7 0.5.8
Transitive dependencies
collection 1.14.12 1.14.13
file 5.2.1
flutter_web_plugins 0.0.0
freezed_annotation 0.7.1 0.11.0
intl 0.16.1
json_annotation 3.0.1
meta 1.1.8 1.2.2
path 1.7.0
path_provider_linux 0.0.1+2
path_provider_platform_interface 1.0.2
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
shared_preferences_linux 0.0.2+1
shared_preferences_macos 0.0.1+10
shared_preferences_platform_interface 1.0.4
shared_preferences_web 0.1.2+7
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0
Dev dependencies
flutter_test