wmh_segement 0.0.4 copy "wmh_segement: ^0.0.4" to clipboard
wmh_segement: ^0.0.4 copied to clipboard

outdated

A new flutter plugin project.

example/lib/main.dart

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

import 'package:flutter/services.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> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
//    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
//  Future<void> initPlatformState() async {
//    String platformVersion;
//    // Platform messages may fail, so we use a try/catch PlatformException.
//    try {
//      platformVersion = await WmhSegement.platformVersion;
//    } on PlatformException {
//      platformVersion = 'Failed to get platform version.';
//    }
//
//    // If the widget was removed from the tree while the asynchronous platform
//    // message was in flight, we want to discard the reply rather than calling
//    // setState to update our non-existent appearance.
//    if (!mounted) return;
//
//    setState(() {
//      _platformVersion = platformVersion;
//    });
//  }

  @override
  Widget build(BuildContext context) {
    List<Map> _adPictures = [
      {'text' : 'hahaha'},
      {'text' : 'hehehe'},
      {'text' : 'xixixi'},
      {'text' : 'hohoho'},
      {'text' : 'heiheihei'},
      {'text' : 'biubiubiu'},
      {'text' : 'lalala'},
    ];

    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'),
              ),
            ),
          ),
        ),
      ),
    );
  }

  _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;
  }
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A new flutter plugin project.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on wmh_segement