Files
ryan d48942b55d refactor(many files): 页面部分的文件结构调整
1.views 文件夹里面分类,页面相关文件;2.公共组件全部放在components里;3.创建resources文件夹放置资源dart文件4.修改二级菜单文字大小

BREAKING CHANGE: 重构,建议删除本地db,再编译
2019-01-28 17:45:18 +08:00

86 lines
2.2 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Created with Android Studio.
* User: ryan
* Date: 2019/1/2
* Time: 上午12:06
* email: zhu.yan@alibaba-inc.com
* tartget: SnackBar 的示例
*/
import 'package:flutter_go/components/widget_demo.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import './demo.dart' as SnackBarDemo;
const String _Text0 =
"""### **简介**
> SnackBar “屏幕底部消息”
- 带有可选操作的轻量级消息,短暂显示在屏幕底部
- SnackBar是用户操作后显示提示信息的一个控件类似Toast会自动隐藏;
""";
const String _Text1 =
"""### **基本用法**
> Scaffold.of(context).showSnackBar(),传递描述消息的 SnackBar 实例;
- 要控制SnackBar保持可见的时间请指定持续时间。
""";
class Demo extends StatefulWidget {
static const String routeName = '/components//Bar/SnackBar';
@override
_DemoState createState() => _DemoState();
}
class _DemoState extends State<Demo> {
@override
Widget build(BuildContext context) {
return WidgetDemo(
title: 'SnackBar',
codeUrl: 'componentss/Bar/SnackBar/demo.dart',
contentList: [allDomes(context, this)],
docUrl: 'https://docs.flutter.io/flutter/material/SnackBar-class.html',
);
}
}
/*
* 所有的 SnackBar widget
* context: 运行上下文
* that: 指向有状态的 StatefulWidget
*/
Widget allDomes(BuildContext context, _DemoState that) {
return Container(
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1),
SizedBox(height: 20.0), // 间距
SnackBarDemo.SnackBarLessDefault(),
SizedBox(height: 20.0), // 间距
])
);
}
/*
* 带align的text
* */
Widget textAlignBar(String txt) {
return new Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
])
);
}