You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MTMusic/lib/view/begin/begin_view.dart

161 lines
6.0 KiB

1 year ago
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:music_player_miao/common/color_extension.dart';
import 'package:music_player_miao/view/begin/login_v.dart';
import 'package:music_player_miao/view/begin/setup_view.dart';
class BeginView extends StatefulWidget {
const BeginView({super.key});
@override
State<BeginView> createState() => _BeginViewState();
}
class _BeginViewState extends State<BeginView> with TickerProviderStateMixin {
late TabController tabController;
@override
void initState() {
tabController = TabController(initialIndex: 0, length: 2, vsync: this);
tabController.addListener(() {
if (!tabController.indexIsChanging) {
FocusScope.of(context).unfocus();
}
});
1 year ago
super.initState();
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
FocusScope.of(context).unfocus();
},
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/img/app_bg.png"),
fit: BoxFit.cover,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
resizeToAvoidBottomInset: false,
body: ScrollConfiguration(
behavior: const ScrollBehavior().copyWith(
physics: const NeverScrollableScrollPhysics(),
),
child: Column(
children: [
// 顶部欢迎部分
Padding(
padding:
const EdgeInsets.only(top: 110, left: 40, right: 40),
child: Row(
1 year ago
children: [
const Column(
1 year ago
children: [
Text(
"你好吖喵星来客,",
1 year ago
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.w500),
1 year ago
),
Row(
children: [
Text(
"欢迎来到",
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.w500),
),
Text(
"喵听",
style: TextStyle(
color: Colors.black,
fontSize: 32,
fontWeight: FontWeight.w800),
),
],
1 year ago
),
],
),
const SizedBox(width: 25),
Image.asset("assets/img/app_logo.png", width: 80),
1 year ago
],
),
),
1 year ago
const SizedBox(height: 20), // 添加一些间距
// 剩余部分使用 Expanded
Expanded(
child: Column(
children: [
// TabBar部分
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30.0),
child: Material(
color: Colors.white,
elevation: 3,
borderRadius: BorderRadius.circular(10),
child: TabBar(
controller: tabController,
unselectedLabelColor: const Color(0xffCDCDCD),
// onTap: (_) {
// FocusScope.of(context).unfocus();
// },
labelColor: Colors.black,
indicatorSize: TabBarIndicatorSize.tab,
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: MColor.LGreen),
tabs: [
Container(
padding: const EdgeInsets.all(8.0),
child: const Text(
'登录',
style: TextStyle(
fontSize: 20,
),
),
),
Container(
padding: const EdgeInsets.all(8.0),
child: const Text(
'注册',
style: TextStyle(
fontSize: 20,
),
),
1 year ago
),
],
1 year ago
),
),
1 year ago
),
// TabBarView部分
Expanded(
child: TabBarView(
controller: tabController,
physics: const NeverScrollableScrollPhysics(),
children: const [
LoginV(),
SignUpView(),
],
),
)
],
),
),
],
1 year ago
),
),
1 year ago
),
));
1 year ago
}
}