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

Custom Cyclevview for jiuji.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:chflutterview/chflutterview.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 Chflutterview.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 = [
      {'imageUrl' : 'http://k.zol-img.com.cn/sjbbs/7692/a7691515_s.jpg', 'link' : '11111'},
      {'imageUrl' : 'http://img4q.duitang.com/uploads/item/201412/31/20141231105810_AiXsu.thumb.700_0.jpeg', 'link' : '22222'},
      {'imageUrl' : 'http://img4q.duitang.com/uploads/item/201504/22/20150422H4331_eLzNY.jpeg', 'link' : '33333'},
      {'imageUrl' : 'http://gss0.baidu.com/7Po3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/caef76094b36acaf71fbb64c7ed98d1001e99c62.jpg', 'link' : '44444'},
      {'imageUrl' : 'http://img4q.duitang.com/uploads/item/201504/26/201504263317_TukwQ.png', 'link' : '55555'},
    ];

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Container(
          alignment: Alignment.topCenter,
          child: CHCycleView(
              imageData: _adPictures,
              cycleWidth: 375.0,
              cycleHeight: 200.0,
              unSelectetColor: Colors.white,
              selectetedColor: Colors.grey,
              pageControllerSize: 10.0,
              duration: 3,
              callBack: (item) {
                print('haha' + item);
              },
          ),
        ),
      ),
    );
  }
}
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Custom Cyclevview for jiuji.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on chflutterview