flutter_icu_segmentview 0.0.1 copy "flutter_icu_segmentview: ^0.0.1" to clipboard
flutter_icu_segmentview: ^0.0.1 copied to clipboard

A new flutter plugin project.

example/lib/main.dart

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

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

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

class _MyAppState extends State<MyApp> {
  MethodChannelSegmentViewPlatform _controller;
  int selectIndex = 0;
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text("加载测试"),
        ),
        body: Stack(
          alignment: Alignment.bottomCenter,
          children: <Widget>[
            new Container(
              child: new Stack(
                children: <Widget>[
                  Container(
                    child: ListView.builder(
                      itemCount: 15,
                      itemBuilder: (context, index) {
                        if (index == 0) {
                          return Container(
                            height: 44,
                            decoration: BoxDecoration(
                              border: Border.all(width: 1, color: Colors.red),
                            ),
                            child: FlutterIcuSegmentview(
                              arguments: {
                                "titles": [
                                  "发的是",
                                  "东方大道",
                                  "儿",
                                  "刚发给对方",
                                  "个梵蒂冈的",
                                  "给发到观复嘟嘟"
                                ],
                                "defaultSelectedIndex": selectIndex,
                                "titleFont": 15,
                                "titleSelectedFont": 20,
                              },
                              onViewCreated: (MethodChannelSegmentViewPlatform
                                  controller) {
                                _controller = controller;
                              },
                              didClickSelectedItemAtIndex: (index) {
                                print("didClickSelectedItemAtIndex  ${index}");
                                selectIndex = index;
                                setState(() {});
                              },
                            ),
                          );
                        } else {
                          return Container(
                            height: 100,
                            decoration: BoxDecoration(
                              border: Border.all(width: 1, color: Colors.red),
                              // color: Theme.of(context).primaryColor,
                            ),
                          );
                        }
                      },
                    ),
                  ),
                  // Container(
                  //   height: 200,
                  //   decoration: BoxDecoration(
                  //     border: Border.all(width: 1, color: Colors.red),
                  //     color: Theme.of(context).primaryColor,
                  //   ),
                  //   child: FlutterFimSegmentView(
                  //     arguments: {
                  //       "titles": [
                  //         "发的是",
                  //         "东方大道",
                  //         "儿",
                  //         "刚发给对方",
                  //         "个梵蒂冈的",
                  //         "给发到观复嘟嘟"
                  //       ],
                  //       "defaultSelectedIndex": 2,
                  //     },
                  //     onViewCreated:
                  //         (MethodChannelSegmentViewPlatform _controller) {
                  //       controller = _controller;
                  //     },
                  //     didClickSelectedItemAtIndex: (index) {
                  //       selectIndex = index;
                  //       setState(() {});
                  //     },
                  //   ),
                  // ),
                  new Container(
                    alignment: Alignment.center,
                    child: new Text("我是flutter控件,没有被遮挡~ ${selectIndex}"),
                  ),
                ],
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(
                  left: 45.0, right: 45.0, top: 0.0, bottom: 50.0),
              child: new Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  FloatingActionButton(
                    onPressed: () {
                      _controller.updateTitles([
                        "发送到",
                        "5464",
                        "涂鸦跳跃",
                        "-==09",
                        "都发谁",
                        "二恶烷",
                        "2432",
                        "发大水时"
                      ]);
                      _controller.updateSelectIndex(0);
                    },
                    child: new Text("重置"),
                  ),
                  FloatingActionButton(
                    onPressed: () {
                      selectIndex++;
                      _controller.updateSelectIndex(selectIndex);
                    },
                    child: new Text("选中下一个"),
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A new flutter plugin project.

Homepage

License

BSD-2-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_icu_segmentview