lazy_code 0.1.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 70

lazy_code #

build and test Publish plugin pub package

lazy_code helps you to speed up coding and looks cleaner in most case. It makes your code clean and easy to read and write.

See the documentation.

[0.1.6] - 12/07/2020 #

  • Add some Navigator's functions.

[0.1.5] - 05/07/2020 #

  • Add popToRoot into functions.

[0.1.4] - 05/07/2020 #

  • Add pushReplacement.

[0.1.3] - 05/07/2020 #

  • Add Navigator's functions helper.

[0.1.2] - 05/07/2020 #

  • Make BoxOfScreen's percent is optional.

[0.1.1] - 04/06/2020 #

  • Add support for context to get textTheme, MediaQueryData, FocusScopeNode, hideKeyboard.

[0.1.0] - 04/06/2020 #

  • Initial release.

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:lazy_code/lazy_code.dart';
import 'second_page.dart';
import 'const.dart';

void main() {
  CodeFasterConfig.setPageRouteType(useMaterial: true);
  runApp(MyApp());
}

const List<dynamic> mainStyle = [mainColor, bold];

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(
              color: Colors.red,
              child: const BoxOfScreen(
                widthPercent: 30,
                heightPercent: 30,
                child: Center(child: Text('hi')),
              ),
            ),
            Container(),
            Text(
              'You have pushed the button this many times:',
              style: styleOf([mainStyle, 11]),
            ),
            // You can create const widget with my custom widget
            const Height(
              50,
              child: FittedBox(child: Text('hi')),
            ),
            // do not use const to create Widget use extension method withs
            // because it still return new Widget
            const Text(
              'You have pushed the button this many times:',
            ).withs([bold, mainColor, 18]),
            // If you want to create const Text
            // you must write code look like below
            const Text(
              'You have pushed the button this many times:',
              style: TextStyle(
                  fontWeight: FontWeight.bold, color: mainColor, fontSize: 18),
            ),
            24.height,
            Text(
              '$_counter',
              style:
                  Theme.of(context).textTheme.headline.withs([16, mainColor]),
            ),
          ],
        ),
      ),
      floatingActionButton: Column(
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          FloatingActionButton(
            heroTag: '1',
            onPressed: () async {
              // use my extension method
              final a = await context.push((context) => SecondPage());
              print(a);
              // use normal code
              //              await Navigator.of(context)
              //                  .push(CupertinoPageRoute(builder: (context) {
              //                return SecondPage();
              //              }));
            },
            child: Icon(Icons.arrow_forward),
          ),
          FloatingActionButton(
            heroTag: '2',
            onPressed: _incrementCounter,
            tooltip: 'Increment',
            child: Icon(Icons.add),
          ),
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  lazy_code: ^0.1.6

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:lazy_code/lazy_code.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
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]
70
Learn more about scoring.

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

Analysis suggestions

Package not compatible with SDK dart

Because:

  • lazy_code that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
intl ^0.16.1 0.16.1
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
path 1.7.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test