|
@@ -1,8 +1,10 @@
|
|
|
import 'dart:ui';
|
|
|
+import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
-import 'package:luojigou_thinking_core/src/data/data_management.dart';
|
|
|
import 'game_park_page.dart';
|
|
|
import 'history_page.dart';
|
|
|
+import '../../view/playroom/navigation_bar.dart';
|
|
|
+import '../../view/playroom/activity_ability_bottom_bounce_frame_widget.dart';
|
|
|
|
|
|
/// 思维芯游戏室列表
|
|
|
class PlayroomPage extends StatefulWidget {
|
|
@@ -13,11 +15,13 @@ class PlayroomPage extends StatefulWidget {
|
|
|
class PlayroomPageState extends State<PlayroomPage> {
|
|
|
late PageController _pageController;
|
|
|
late ValueNotifier<int> _valueNotifier;
|
|
|
+ late bool _isShow; // 记录按钮切换状态
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
// TODO: implement initState
|
|
|
super.initState();
|
|
|
+ _isShow = false;
|
|
|
_pageController = PageController(initialPage: 0);
|
|
|
_valueNotifier = ValueNotifier(0);
|
|
|
_valueNotifier.addListener(() {
|
|
@@ -37,165 +41,41 @@ class PlayroomPageState extends State<PlayroomPage> {
|
|
|
return Scaffold(
|
|
|
body: Container(
|
|
|
decoration: BoxDecoration(gradient: LinearGradient(colors: [Color(0xFFADCCFF), Color(0xFF6EA7FF)], begin: Alignment.topRight, end: Alignment.topLeft)),
|
|
|
- child: Column(
|
|
|
+ child: Stack(
|
|
|
children: [
|
|
|
- NavigationBar(
|
|
|
- valueNotifier: _valueNotifier,
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- child: Container(
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Color(0xFFFDFDFD),
|
|
|
- borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)),
|
|
|
- ),
|
|
|
+ Column(
|
|
|
+ children: [
|
|
|
+ NavigationBar(valueNotifier: _valueNotifier),
|
|
|
+ Expanded(
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(color: Color(0xFFFDFDFD), borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25))),
|
|
|
child: PageView(
|
|
|
controller: _pageController,
|
|
|
onPageChanged: (index) {
|
|
|
_valueNotifier.value = index;
|
|
|
},
|
|
|
children: [
|
|
|
- GameParkPage(),
|
|
|
+ GameParkPage(clickAction: () {
|
|
|
+ setState(() {
|
|
|
+ _isShow = !_isShow;
|
|
|
+ });
|
|
|
+ }),
|
|
|
HistoryPage(),
|
|
|
],
|
|
|
),
|
|
|
))
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-class NavigationBar extends StatefulWidget {
|
|
|
- final ValueNotifier<int> valueNotifier;
|
|
|
-
|
|
|
- const NavigationBar({Key? key, required this.valueNotifier}) : super(key: key);
|
|
|
-
|
|
|
- @override
|
|
|
- NavigationBarState createState() => new NavigationBarState();
|
|
|
-}
|
|
|
-
|
|
|
-class NavigationBarState extends State<NavigationBar> {
|
|
|
- ToggleState _toggleState = ToggleState.GamePark;
|
|
|
-
|
|
|
- @override
|
|
|
- void initState() {
|
|
|
- // TODO: implement initState
|
|
|
- super.initState();
|
|
|
- widget.valueNotifier.addListener(() {
|
|
|
- setState(() {
|
|
|
- _toggleState = [ToggleState.GamePark, ToggleState.History][widget.valueNotifier.value];
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- @override
|
|
|
- Widget build(BuildContext context) {
|
|
|
- return Container(
|
|
|
- height: MediaQuery.of(context).padding.top + 44,
|
|
|
- padding: EdgeInsets.only(left: 18, right: 18, bottom: 8.5),
|
|
|
- alignment: Alignment.bottomCenter,
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
- Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
- children: [
|
|
|
- GestureDetector(
|
|
|
- onTap: () {},
|
|
|
- child: Container(
|
|
|
- width: 25,
|
|
|
- height: 25,
|
|
|
- alignment: Alignment.center,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Color(0x4DFFFFFF),
|
|
|
- borderRadius: BorderRadius.circular(12.5),
|
|
|
- ),
|
|
|
- child: Image.asset(
|
|
|
- "assets/thinking_core/back_white.png",
|
|
|
- width: 8.5,
|
|
|
- height: 13,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- SizedBox(width: 15),
|
|
|
- getSelectButton(ToggleState.GamePark, _toggleState == ToggleState.GamePark, 0),
|
|
|
- SizedBox(width: 20),
|
|
|
- getSelectButton(ToggleState.History, _toggleState == ToggleState.History, 1),
|
|
|
- ],
|
|
|
- ),
|
|
|
- Container(
|
|
|
- width: 88,
|
|
|
- height: 30,
|
|
|
- decoration: BoxDecoration(color: Color(0xFFFFFFFF), borderRadius: BorderRadius.circular(15)),
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Image.asset("assets/thinking_core/calendar.png", width: 13, height: 11),
|
|
|
- SizedBox(width: 7),
|
|
|
- Text(
|
|
|
- "3月",
|
|
|
- style: TextStyle(fontSize: 12, height: 16.5 / 12, color: Color(0xFF3A4CA8), fontWeight: FontWeight.w500),
|
|
|
- ),
|
|
|
- SizedBox(width: 2),
|
|
|
- Container(
|
|
|
- width: 7,
|
|
|
- height: 7,
|
|
|
- child: CustomPaint(
|
|
|
- painter: TrianglePainter(),
|
|
|
- ),
|
|
|
- )
|
|
|
],
|
|
|
),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- Widget getSelectButton(ToggleState toggleState, bool isSelected, int tag) {
|
|
|
- String _title = toggleState == ToggleState.GamePark ? "游戏乐园" : "历史记录";
|
|
|
- TextStyle _style = isSelected ? TextStyle(color: Color(0xFFFFFFFF), fontSize: 18, height: 25 / 18, fontWeight: FontWeight.w600) : TextStyle(color: Color(0xB3FFFFFF), fontSize: 15, height: 21 / 15, fontWeight: FontWeight.w500);
|
|
|
-
|
|
|
- return GestureDetector(
|
|
|
- onTap: () {
|
|
|
- setState(() {
|
|
|
- _toggleState = toggleState;
|
|
|
- widget.valueNotifier.value = tag;
|
|
|
- });
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- // padding: EdgeInsets.symmetric(vertical: 20, horizontal: 13),
|
|
|
- color: Colors.transparent,
|
|
|
- child: Text(
|
|
|
- _title,
|
|
|
- style: _style,
|
|
|
+ _isShow
|
|
|
+ ? ActivityAbilityBottomBounceFrameWidget(closeAction: () {
|
|
|
+ setState(() {
|
|
|
+ _isShow = !_isShow;
|
|
|
+ });
|
|
|
+ })
|
|
|
+ : SizedBox(),
|
|
|
+ ],
|
|
|
),
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-class TrianglePainter extends CustomPainter {
|
|
|
- @override
|
|
|
- void paint(Canvas canvas, Size size) {
|
|
|
- // TODO: implement paint
|
|
|
- Paint paint = Paint()
|
|
|
- ..color = Color(0xFF3A4CA8)
|
|
|
- ..strokeWidth = 2;
|
|
|
- Path path = Path();
|
|
|
-
|
|
|
- path.moveTo(0, size.height / 2);
|
|
|
- path.lineTo(size.width / 2, size.height);
|
|
|
- path.lineTo(size.width, size.height / 2);
|
|
|
- path.close();
|
|
|
-
|
|
|
- canvas.drawPath(path, paint);
|
|
|
- }
|
|
|
-
|
|
|
- @override
|
|
|
- bool shouldRepaint(covariant CustomPainter oldDelegate) {
|
|
|
- // TODO: implement shouldRepaint
|
|
|
- return true;
|
|
|
- }
|
|
|
-}
|