预览
![](https://img.haomeiwen.com/i19339252/1da3944e546a9181.png)
安装
loading_indicator_view: ^1.1.0
导入
import 'package:loading_indicator_view/loading_indicator_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:loading_indicator_view/loading_indicator_view.dart';
class LoadingGroup extends StatefulWidget {
LoadingGroup({Key key, this.title}) : super(key: key);
final String title;
@override
_LoadingGroupState createState() => _LoadingGroupState();
}
class _LoadingGroupState extends State<LoadingGroup> {
int _orderNum = 1;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color.fromARGB(255, 185, 63, 81),
appBar: AppBar(
title: Text("加载组件"),
),
body: GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
childAspectRatio: 1.0,
),
children: <Widget>[
wrapOrder(Center(child: LineSpinFadeLoaderIndicator())),
wrapOrder(Center(child: BallBeatIndicator())),
wrapOrder(Center(child: BallClipRotateMultipleIndicator())),
wrapOrder(Center(child: BallGridPulseIndicator())),
wrapOrder(Center(child: LineScaleIndicator())),
wrapOrder(Center(child: BallPulseRiseIndicator())),
wrapOrder(Center(child: BallScaleRippleMultipleIndicator())),
wrapOrder(Center(child: BallZigZagIndicator())),
wrapOrder(Center(child: BallScaleIndicator())),
wrapOrder(Center(child: BallPulseSyncIndicator())),
wrapOrder(Center(child: BallScaleMultipleIndicator())),
wrapOrder(Center(child: BallPulseIndicator())),
wrapOrder(Center(child: BallClipRotatePulseIndicator())),
wrapOrder(Center(child: BallGridBeatIndicator())),
wrapOrder(Center(child: SquareSpinIndicator())),
wrapOrder(Center(child: BallSpinFadeLoaderIndicator())),
wrapOrder(Center(child: BallScaleRippleIndicator())),
wrapOrder(Center(child: SemiCircleSpinIndicator())),
wrapOrder(Center(child: LineScalePulseOutIndicator())),
wrapOrder(Center(child: BallClipRotateIndicator())),
wrapOrder(Center(child: PacmanIndicator())),
wrapOrder(Center(child: BallRotateIndicator())),
wrapOrder(Center(child: CubeTransitionIndicator())),
wrapOrder(Center(child: TriangleSkewSpinIndicator())),
],
),
);
}
@override
void didUpdateWidget(LoadingGroup oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget != widget) {
_orderNum = 1;
}
}
Widget wrapContainer(Widget child, [Color backgroundColor = Colors.green]) =>
Container(color: backgroundColor, child: child);
Widget wrapOrder(Widget child) => Stack(children: <Widget>[
child,
Positioned(
left: 8,
bottom: 0,
child: Text("${_orderNum++}",
style: TextStyle(color: Colors.white, fontSize: 18)),
),
]);
}
动画类型
![](https://img.haomeiwen.com/i19339252/f1a1c08f8603ae7b.png)
执照
Copyright 2019 Hitomis, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
网友评论