LinearProgressIndicator控件是质感设计中的线性进度指示器,具体内容如下
import 'package:flutter/material.dart'; class ActionViewEcology extends StatelessWidget { /* * 构建函数,传递参数 * 最大能量值 * 最大饥饿值 * 最大情绪值 * 当前能量值 * 当前饥饿值 * 当前情绪值 */ ActionViewEcology({ this.maximumEmergy, this.maximumHunger, this.maximumMood, this.currentEmergy, this.currentHunger, this.currentMood, }); int maximumEmergy; int maximumHunger; int maximumMood; int currentEmergy; int currentHunger; int currentMood; // 获取进度条描述文本 Align _getNameText(BuildContext context, String text) { return new Align( alignment: FractionalOffset.topLeft, child: new Text( text, style: new TextStyle( fontSize: 15.0, color: Colors.black, height: 1.5, ) ) ); } @override Widget build(BuildContext context) { return new Container( margin: const EdgeInsets.fromLTRB(17.0, 0.0, 17.0, 10.0), child: new Column( children:[ _getNameText(context, '能量($currentEmergy/$maximumEmergy)'), new LinearProgressIndicator(value: currentEmergy/maximumEmergy), _getNameText(context, '饥饿($currentHunger/$maximumHunger)'), new LinearProgressIndicator(value: currentHunger/maximumHunger), _getNameText(context, '心情($currentMood/$maximumMood)'), new LinearProgressIndicator(value: currentMood/maximumMood), ] ) ); } }
在main.dart中调用上面的ActionViewEcology类,传入相关参数,效果如下:
水物理模拟器手机版 安卓版v1.3.39
水物理模拟器是一款玩法非常多样的沙盒建造类手游,玩家可以在游
创造世界2 安卓版v2.1.0
创造世界2是一款非常有趣的模拟类游戏,玩家在游戏中可以控制自
时光杂货店0.1折 安卓版v1.9.1
时光杂货店折扣版是一款模拟经营类游戏,玩家们将在游戏中重回八
TRS12火车模拟器(内置模组) 安卓版v1.3.9
TRS12火车模拟器(内置模组)是一个非常有趣的火车模拟游戏
泽塔奥特曼升华器模拟器 最新版v2.3
泽塔奥特曼升华器模拟器是根据《泽塔奥特曼》电视剧出现的变身器