提交 a33c9b33 authored 作者: shixiaochen's avatar shixiaochen

1、修改 StateLayout

上级 272dee82
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../utils/image_utils.dart';
class StateLayout extends StatefulWidget { class StateLayout extends StatefulWidget {
const StateLayout({Key? key, required this.type, this.hintText}) const StateLayout({Key? key, required this.type, this.hintText})
: super(key: key); : super(key: key);
final StateType type; final StateType type;
final String? hintText; final String? hintText;
@override @override
State<StateLayout> createState() => _StateLayoutState(); State<StateLayout> createState() => _StateLayoutState();
} }
...@@ -16,14 +15,7 @@ class StateLayout extends StatefulWidget { ...@@ -16,14 +15,7 @@ class StateLayout extends StatefulWidget {
class _StateLayoutState extends State<StateLayout> { class _StateLayoutState extends State<StateLayout> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SingleChildScrollView( return widget.type == StateType.loading ? _loadingWidget() : _otherWidget();
child: SizedBox(
height: MediaQuery.of(context).size.height - 30.0,
child: widget.type == StateType.loading
? _loadingWidget()
: _otherWidget(),
),
);
} }
Widget _loadingWidget() { Widget _loadingWidget() {
...@@ -32,13 +24,6 @@ class _StateLayoutState extends State<StateLayout> { ...@@ -32,13 +24,6 @@ class _StateLayoutState extends State<StateLayout> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: const [ children: const [
CupertinoActivityIndicator(radius: 16.0), CupertinoActivityIndicator(radius: 16.0),
SizedBox(
width: double.infinity,
height: 16.0,
),
SizedBox(
height: 50,
),
], ],
); );
} }
...@@ -63,28 +48,24 @@ class _StateLayoutState extends State<StateLayout> { ...@@ -63,28 +48,24 @@ class _StateLayoutState extends State<StateLayout> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Opacity( // Opacity(
opacity: 1, // opacity: 1,
child: Container( // child: Container(
height: 120.0, // height: 120.0,
width: 120.0, // width: 120.0,
decoration: BoxDecoration( // decoration: BoxDecoration(
image: DecorationImage( // image: DecorationImage(
image: ImageUtils.getAssetImage(img), // image: ImageUtils.getAssetImage(img),
), // ),
), // ),
)), // )),
const SizedBox( const SizedBox(
width: double.infinity,
height: 16.0, height: 16.0,
), ),
Text( Text(
hintText, hintText,
style: const TextStyle(fontSize: 14, color: Colors.grey), style: const TextStyle(fontSize: 14, color: Colors.grey),
), ),
const SizedBox(
height: 50,
),
], ],
); );
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论