dant 0.1.12+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 67

logo

Flutter UI Components built on dant

Getting Started #

step

dependencies:
  dant: lastVersion

Usage

import 'package:example/comm/app.dart';
import 'package:example/comm/params.dart';
import 'package:example/comm/sp_util.dart';
import 'package:example/comm/theme_notification.dart';
import 'package:example/view/home_page.dart';
import 'dant.dart';
import 'package:flutter/material.dart';

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

class IndexPage extends StatefulWidget {
  @override
  IndexPageState createState() => IndexPageState();
}

class IndexPageState extends State<IndexPage> {
  ThemeMode themeMode = ThemeMode.system;

  @override
  void initState() {
    super.initState();
    SpUtil.getInstance().then((_) {
      App.isDark = SpUtil.getBool(Params.IS_DARK, defValue: false);
      toggleThemeMode();
      setState(() {});
    });
  }

  @override
  Widget build(BuildContext context) {
    return NotificationListener<ThemeNotification>(
      onNotification: (ThemeNotification bean) {
        App.isDark = bean.isDark;
        SpUtil.putBool(Params.IS_DARK, App.isDark);
        toggleThemeMode();
        setState(() {});
        return true;
      },
      child: MaterialApp(
        title: 'Dant',
        darkTheme: kDarkTheme,
        theme: kLightTheme,
        themeMode: themeMode,
        home: HomePage(),
      ),
    );
  }

  void toggleThemeMode() {
    themeMode = App.isDark ? ThemeMode.dark : ThemeMode.system;
  }
}


Widgets #

[0.1.12+1] #

  • TODO: 调整TextField

[0.1.12] #

  • TODO: 调整TextField
  • TODO: 调整Popup

[0.1.11] #

  • TODO: 优化TextField
  • TODO: 优化CheckedBox
  • TODO: 优化Radio

[0.1.10] #

  • TODO: 优化Dialog

[0.1.9] #

  • TODO: 优化BottomSheet

[0.1.7] #

  • TODO: 优化Button

[0.1.6] #

  • TODO: 优化TextField

[0.1.5] #

  • TODO: 新增自定义dialog
  • TODO: 新增PreView

[0.1.4] #

  • TODO: 优化Number

[0.1.3] #

  • TODO: 优化Badge使用方式

[0.1.2] #

  • TODO: 修复dialog错误

[0.1.1] #

  • TODO: pub 优化

[0.1.0] #

  • TODO: pub 优化

[0.0.3] #

  • TODO: 更新部分文案.

[0.0.2] #

  • TODO: 更新部分文案.

[0.0.1] #

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:dant/dant.dart';
import 'package:example/comm/app.dart';
import 'package:example/comm/params.dart';
import 'package:example/comm/sp_util.dart';
import 'package:example/comm/theme_notification.dart';
import 'package:example/view/home_page.dart';
import 'package:flutter/material.dart';

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

class IndexPage extends StatefulWidget {
  @override
  IndexPageState createState() => IndexPageState();
}

class IndexPageState extends State<IndexPage> {
  ThemeMode themeMode = ThemeMode.system;

  @override
  void initState() {
    super.initState();
    SpUtil.getInstance().then((_) {
      App.isDark = SpUtil.getBool(Params.IS_DARK, defValue: false);
      toggleThemeMode();
      setState(() {});
    });
  }

  @override
  Widget build(BuildContext context) {
    return NotificationListener<ThemeNotification>(
      onNotification: (ThemeNotification bean) {
        App.isDark = bean.isDark;
        SpUtil.putBool(Params.IS_DARK, App.isDark);
        toggleThemeMode();
        setState(() {});
        return true;
      },
      child: MaterialApp(
        title: 'Dant',
        darkTheme: kDarkTheme,
        theme: kLightTheme,
        themeMode: themeMode,
        home: HomePage(),
      ),
    );
  }

  void toggleThemeMode() {
    themeMode = App.isDark ? ThemeMode.dark : ThemeMode.system;
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  dant: ^0.1.12+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:dant/dant.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
35
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
67
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.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • dant that is a package requiring null.

Health suggestions

Fix lib/pwd_field/index.dart. (-1 points)

Analysis of lib/pwd_field/index.dart reported 2 hints:

line 59 col 60: 'title' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline6. This feature was deprecated after v1.13.8..

line 60 col 74: 'title' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline6. This feature was deprecated after v1.13.8..

Fix lib/theme/index.dart. (-1 points)

Analysis of lib/theme/index.dart reported 2 hints:

line 9 col 5: 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText2. This feature was deprecated after v1.13.8..

line 9 col 17: 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText2. This feature was deprecated after v1.13.8..

Fix lib/toast/index.dart. (-1 points)

Analysis of lib/toast/index.dart reported 2 hints:

line 195 col 64: 'title' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline6. This feature was deprecated after v1.13.8..

line 214 col 64: 'title' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline6. This feature was deprecated after v1.13.8..

Fix additional 14 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/bottomsheet/index.dart (Run flutter format to format lib/bottomsheet/index.dart.)
  • lib/dant.dart (Run flutter format to format lib/dant.dart.)
  • lib/dialog/index.dart (Run flutter format to format lib/dialog/index.dart.)
  • lib/divider/index.dart (Run flutter format to format lib/divider/index.dart.)
  • lib/drawer/index.dart (Run flutter format to format lib/drawer/index.dart.)
  • lib/marquee/index.dart (Run flutter format to format lib/marquee/index.dart.)
  • lib/number/index.dart (Run flutter format to format lib/number/index.dart.)
  • lib/popup/index.dart (Run flutter format to format lib/popup/index.dart.)
  • lib/preview/index.dart (Run flutter format to format lib/preview/index.dart.)
  • lib/radio/index.dart (Run flutter format to format lib/radio/index.dart.)
  • lib/skeleton/index.dart (Run flutter format to format lib/skeleton/index.dart.)
  • lib/star/index.dart (Run flutter format to format lib/star/index.dart.)
  • lib/swipe/index.dart (Run flutter format to format lib/swipe/index.dart.)
  • lib/textfield/index.dart (Run flutter format to format lib/textfield/index.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
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