wmh_segement 0.0.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 42

wmh_segement #

A Flutter segement and if you want, you can edit some properties.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

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

the way to use: WMHSegement( appbarColor: Colors.lightBlue, leadingWidget: Container(), paramPages: [{'text' : showTitle}], itemColor: Colors.black,//showTitleTextColor indicateColor: Colors.lightBlue,//indicatorLineColor itemTitleFont: 16.0,//showTitleTextFont selectedColor: Colors.lightBlue,//showTitleSelectedTextColor unSelectColor: Colors.black,//same to showTitleTextColor indicatorHeight: 3.0,//indicatorLineHeight haveSeperateLine: true,//segement can scroll bottomViewArr: List

0.0.6 #

  • TODO: Add Customer commonview

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin{
  TabController tabController;
  List<Map> _adPictures = [
    {'text' : 'hahaha'},
    {'text' : 'hehehe'},
    {'text' : 'xixixi'},
    {'text' : 'hohoho'},
    {'text' : 'heiheihei'},
    {'text' : 'biubiubiu'},
    {'text' : 'lalala'},
  ];

  @override
  void initState() {
    super.initState();
    tabController = new TabController(length: _adPictures.length, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Container(

            child: WMHSegement(
              appbarColor: Colors.lightBlue,
              leadingWidget: Container(),
              paramPages: _adPictures,
              itemColor: Colors.black,
              itemBackgroundColor: Colors.white,
              indicateColor: Colors.red,
              itemTitleFont: 16.0,
              selectedColor: Colors.lightBlue,
              unSelectColor: Colors.black,
              indicatorHeight: 3.0,
              haveSeperateLine: true,
              bottomViewArr: _getWidgetArrs(),
              titleWidget: Container(
                  child: Text('Segement标签页', style: TextStyle(color: Colors.white)),
              ),
              haveCommonVIew: true,
              commonWidget: Container(
                height: 50,
                width: 100,
                color: Colors.red,
                child: Text('hakjshjsa'),
              ),
              tabController: tabController,
              haveUpview: true,
              commonWidgetUp: Container(
                height: 50,
                width: 100,
                color: Colors.red,
                child: Text('hakjshjsa'),
              ),
              upViewHeight: 60,
            ),
          ),
        ),
      ),
    );
  }

  _getWidgetArrs() {
    List<Map> _adPictures = [
      {'text' : 'hahaha'},
      {'text' : 'hehehe'},
      {'text' : 'xixixi'},
      {'text' : 'hohoho'},
      {'text' : 'heiheihei'},
      {'text' : 'biubiubiu'},
      {'text' : 'lalala'},
    ];

    List<Widget> subArr = [];
    for (var i = 0; i < _adPictures.length; i++) {
      subArr.add(Container(
        child: Center(child: Text(_adPictures[i]['text'].toString())),
        color: Color.fromRGBO(237, 232 - i * 10, 240 - i * 20, 1.0),
      ));
    }

    return subArr;
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  wmh_segement: ^0.0.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:wmh_segement/wmh_segement.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
3
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
42
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:wmh_segement/wmh_segement.dart]

Package does not support Flutter platform macos

Because of import path [package:wmh_segement/wmh_segement.dart]

Package does not support Flutter platform web

Because of import path [package:wmh_segement/wmh_segement.dart]

Package does not support Flutter platform windows

Because of import path [package:wmh_segement/wmh_segement.dart]

Package not compatible with SDK dart

because of import path [wmh_segement]

Health suggestions

Fix lib/wmh_segement.dart. (-0.50 points)

Analysis of lib/wmh_segement.dart reported 1 hint:

line 3 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: WMHSegement.titleCanScroll

Maintenance issues and suggestions

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

At the time of the analysis the homepage field https://code.9ji.com/minhang.wang/WMHSegementView 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.

Dependencies

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