flutter_fim_segmentview 0.0.2 copy "flutter_fim_segmentview: ^0.0.2" to clipboard
flutter_fim_segmentview: ^0.0.2 copied to clipboard

A Flutter plugin for using SegmentView in iOS

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:flutter_fim_segmentview/flutter_fim_segmentview.dart';

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

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

class _MyAppState extends State<MyApp> {
  MethodChannelSegmentViewPlatform controller;
  int selectIndex;
  @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: FlutterFimSegmentView(
                              arguments: {
                                "titles": [
                                  "发的是",
                                  "东方大道",
                                  "儿",
                                  "刚发给对方",
                                  "个梵蒂冈的",
                                  "给发到观复嘟嘟"
                                ],
                                "defaultSelectedIndex": selectIndex,
                              },
                              onViewCreated: (MethodChannelSegmentViewPlatform
                                  _controller) {
                                controller = _controller;
                              },
                              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.resetDatas([
                        "发送到",
                        "5464",
                        "涂鸦跳跃",
                        "-==09",
                        "都发谁",
                        "二恶烷",
                        "2432",
                        "发大水时"
                      ], 4);
                    },
                    child: new Text("Start"),
                  ),
                  FloatingActionButton(
                    onPressed: () {
                      selectIndex = 1;
                      setState(() {});
                    },
                    child: new Text("Stop"),
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

A Flutter plugin for using SegmentView in iOS

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_fim_segmentview