增加导航,添加welcome按钮组
This commit is contained in:
parent
f66c0f247c
commit
a8d6c2f07e
5
.gitignore
vendored
5
.gitignore
vendored
@ -46,5 +46,8 @@ app.*.map.json
|
||||
/android/app/release
|
||||
|
||||
.dart_tool
|
||||
.fvm
|
||||
.vscode
|
||||
|
||||
# FVM Version Cache
|
||||
.fvm/
|
||||
.fvmrc
|
||||
@ -36,3 +36,8 @@ samples, guidance on mobile development, and a full API reference.
|
||||
- 在main中使用theme设置全局样式
|
||||
- 在padding中使用edgeinsets.symmetric设置水平间距
|
||||
- image中,使用fit Boxfit来设置宽高适配
|
||||
## 导航,布局
|
||||
- 从上到下,从左到右分析布局
|
||||
- 写布局前,先把结构列好,用函数拆分,用_bulid开头,表示私有布局函数
|
||||
- 在使用elevatedbutton时,使用style将样式还原,在外面套一层Container作为装饰,更方便配置
|
||||
- 使用Navigator.pushReplacement 替换路由
|
||||
|
||||
@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=file:///D:/Gradle/.gradle/wrapper/dists/gradle-6.7-all.zip
|
||||
distributionUrl=file:///C:/Users/24811/.gradle/wrapper/dists/gradle-6.7-all.zip
|
||||
# distributionUrl=file:///D:/Gradle/.gradle/wrapper/dists/gradle-6.7-all.zip
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'pages/welcome.dart';
|
||||
import 'pages/splash.dart';
|
||||
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@ -12,9 +13,11 @@ class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: const WelcomePage(),
|
||||
home: const SplashPage(),
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(
|
||||
//设置主题色
|
||||
primarySwatch: Colors.orange,
|
||||
fontFamily: 'Poppins',
|
||||
),
|
||||
);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../common/app_colors.dart';
|
||||
import '../common/assets.dart';
|
||||
import '../pages/Welcome.dart';
|
||||
|
||||
class SplashPage extends StatefulWidget {
|
||||
const SplashPage({Key? key}) : super(key: key);
|
||||
@ -30,6 +31,10 @@ class _SplashPageState extends State<SplashPage> {
|
||||
|
||||
if (number == 0) {
|
||||
print('倒计时结束 ');
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) {
|
||||
return const WelcomePage();
|
||||
}));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,55 @@ import '../common/assets.dart';
|
||||
class WelcomePage extends StatelessWidget {
|
||||
const WelcomePage({Key? key}) : super(key: key);
|
||||
|
||||
//按钮组
|
||||
Widget _bulidBtns() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Row(
|
||||
children: [
|
||||
//skip按钮
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text('Skip',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Color(0xff2B2A2A),
|
||||
fontWeight: FontWeight.w300,
|
||||
)),
|
||||
),
|
||||
|
||||
//弹开
|
||||
const Spacer(),
|
||||
|
||||
//getstarted按钮
|
||||
//套一层Container,可以做很多事,比如设置尺寸
|
||||
Container(
|
||||
height: 42,
|
||||
width: 139,
|
||||
//需要裁切,不然没有圆角
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(32),
|
||||
),
|
||||
child: ElevatedButton(
|
||||
onPressed: (() {}),
|
||||
style: ButtonStyle(
|
||||
elevation: MaterialStateProperty.all(0),
|
||||
//设置最小值为0,是的尺寸为children尺寸
|
||||
minimumSize: MaterialStateProperty.all(Size.zero)),
|
||||
child: const Text('Get Started',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w300,
|
||||
)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Padding _bulidText() {
|
||||
return const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 38),
|
||||
@ -36,11 +85,13 @@ class WelcomePage extends StatelessWidget {
|
||||
height: 300,
|
||||
//宽撑满
|
||||
width: double.infinity,
|
||||
|
||||
fit: BoxFit.fitWidth),
|
||||
|
||||
const SizedBox(
|
||||
height: 70,
|
||||
),
|
||||
//按钮组
|
||||
Container(),
|
||||
_bulidBtns(),
|
||||
|
||||
//end
|
||||
],
|
||||
|
||||
46
pubspec.lock
46
pubspec.lock
@ -5,56 +5,56 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.8.2"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cupertino_icons
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
version: "1.0.4"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
flutter:
|
||||
@ -66,7 +66,7 @@ packages:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
flutter_test:
|
||||
@ -78,35 +78,35 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.11"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
sky_engine:
|
||||
@ -118,56 +118,56 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.8"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
sdks:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user