xh_framework 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 36

xh_framework #

A new Flutter package project.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.0.3] - TODO: Add release date. #

[0.0.2] - TODO: Add release date. #

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.


import 'package:flutter/material.dart';
import 'package:xh_framework/xh_framework.dart';

import 'com.xh.example/model/user_info_model.dart';
import 'com.xh.example/network/test_request.dart';
import 'com.xh.example/widget/test_widget2.dart';
import 'com.xh.example/widget/user_info.dart';

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

class MyApp extends XHStatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        home: MyHomePage(title: 'Flutter Demo Home Page'),
        routes: <String, WidgetBuilder>{
          '/refresh': (BuildContext context) => null,

class MyHomePage extends XHStatefulWidget {

  final String title;

  _MyHomePageState createState() => _MyHomePageState(data: title);

class _MyHomePageState extends XHStatefulWidgetState<MyHomePage, String> {
  int _counter = 0;

  _MyHomePageState({data}) : super(data: data);

  void _incrementCounter() {
        context: context,
        builder: (context) {
          return XHSimpleDialog(context, list: ["条目1", "条目2", "条目3"],
              onTap: (action, data) {

//    showDialog(
//        context: context,
//        builder: (context) {
//          return XHAlertDialog(context,
//              title: Text("这是标题"),
//              content: Text("这是内容"),
//              confirm: "确定",
//              cancel: "取消", onTap: (action, data) {
//            showToast(data);
//          });
//        });
//    showDialog(
//        context: context,
//        builder: (context) {
//          return XHCupertinoAlertDialog(context,
//              title: Text("这是标题"),
//              content: Text("这是内容"),
//              confirm: "确定",
//              cancel: "取消", onTap: (action, data) {
//            showToast(data);
//          });
//        });

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(data),
      body: Center(
          child: Column(
        children: <Widget>[
              onTap: (action, data) => print('x' + data.toString()),
              data: Bean('wuchuang1', 18)),
              onTap: (action, data) => print('x' + data.toString()),
              data: Bean('wuchuang2', 18)),
            height: 100,
            child: UserInfo(
              onTap: (action, data) => doRequest(context),
              data: UserInfoModel(
                    width: 50,
                    height: 50,
                  'Android 开发',
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),

  void doRequest(BuildContext context) {
        onSuccess: (model) => print(model.ranking.title),
        onError: (e) => print(e));

//    TestRequest.getInstance().testPost(
//        onSuccess: (data) => print(data.toString()),
//        onError: (e) => print(e.toString()));

        onSuccess: (data) => closeLoader(),
        onProgress: (int count, int total) =>
            print(count.toString() + ":" + total.toString()),
        onError: (e) {

Use this package as a library

1. Depend on it

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

  xh_framework: ^0.0.3

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

We analyzed this package on Apr 4, 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/com/xh/base/xh_list_widget.dart.

Run flutter format to format lib/com/xh/base/xh_list_widget.dart.

Format lib/com/xh/base/xh_widget.dart.

Run flutter format to format lib/com/xh/base/xh_widget.dart.

Format lib/com/xh/callback/on_tap_callback.dart.

Run flutter format to format lib/com/xh/callback/on_tap_callback.dart.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/com/xh/callback/on_tap_list_callback.dart (Run flutter format to format lib/com/xh/callback/on_tap_list_callback.dart.)
  • lib/com/xh/dialog/xh_simple_dialog.dart (Run flutter format to format lib/com/xh/dialog/xh_simple_dialog.dart.)
  • lib/com/xh/refresh/xh_refresh_state.dart (Run flutter format to format lib/com/xh/refresh/xh_refresh_state.dart.)
  • lib/xh_framework.dart (Run flutter format to format lib/xh_framework.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (dio, fluttertoast).

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/chuangWu/xh_framework was unreachable.

The package description is too short. (-20 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.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio ^2.1.16 2.2.2 3.0.9
flutter 0.0.0
fluttertoast ^3.1.3 3.1.3 4.0.1
Transitive dependencies
collection 1.14.11 1.14.12
cookie_jar 1.0.1
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies