alicdn_image_flutter_plugin 0.0.3 copy "alicdn_image_flutter_plugin: ^0.0.3" to clipboard
alicdn_image_flutter_plugin: ^0.0.3 copied to clipboard

Flutter plugin of display image provided by AliCDN.

example/lib/main.dart

import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

void main() {
  debugRepaintRainbowEnabled = true;
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    double scrWidth = MediaQuery.of(context).size.width;
    double scrHeight = MediaQuery.of(context).size.height;

    int columnCount = 60;
    int rowCount = (columnCount * scrHeight / scrWidth).ceil();
    double cellSize = scrWidth / columnCount - 1;
    double fontSize = cellSize / 2;

    final rng = new Random();
    final rows = <Widget>[];

    rows.add(RepaintBoundary(child: SizedBox(
      width: 20,
      height: 20,
      child: CircularProgressIndicator(),
    )));

    rows.add(Text(
      '$_counter',
      style: Theme.of(context).textTheme.display1,
    ));

    for (var i = 0; i < rowCount; i++) {
      final eachRow = <Widget>[];
      for (var j = 0; j < columnCount; j++) {
        eachRow.add(new Container(
          width: cellSize,
          height: cellSize,
          margin: EdgeInsets.all(0.5),
          decoration: BoxDecoration(
            color: Colors.teal.withOpacity(0.5),
            border: Border.all(width: 0.5, color: Colors.teal),
          ),
          child: Center(
            child: Text(
              rng.nextInt(10).toString(),
              style: TextStyle(
                  fontWeight: FontWeight.w200,
                  fontSize: fontSize,
                  color: Colors.black),
            ),
          ),
        ));
      }
      rows.add(new Row(
        children: eachRow,
      ));
    }

    return Scaffold(
      floatingActionButton: FlatButton(
        color: Colors.blue,
        onPressed: _incrementCounter,
      ),
      body: Column(
        children: rows,
      ),
    );
  }
}
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Flutter plugin of display image provided by AliCDN.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on alicdn_image_flutter_plugin