ToneSnap_FSX_Flutter/lib/modules/musicoo/initial/initial_view.dart

55 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:tone_snap/components/keep_alive_wrapper.dart';
import 'package:tone_snap/modules/musicoo/initial/initial_controller.dart';
class InitialView extends GetView<InitialController> {
const InitialView({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: PageView(
physics: const NeverScrollableScrollPhysics(),
controller: controller.pageController,
children: controller.pages.map((e) => KeepAliveWrapper(child: e.widget)).toList(),
),
),
],
),
bottomNavigationBar: _buildBottomAppBar(),
);
}
BottomAppBar _buildBottomAppBar() {
return BottomAppBar(
height: kBottomNavigationBarHeight,
padding: EdgeInsets.zero,
color: Colors.transparent,
child: SizedBox(
height: double.infinity,
child: Row(
children: controller.pages.asMap().entries.map((e) {
return Expanded(
child: GestureDetector(
onTap: () => controller.onBottomAppBarItemChanged(e.key),
child: Obx(() {
return Image.asset(
e.value.icons[controller.currentIndex.value == e.key ? 1 : 0],
width: controller.currentIndex.value == e.key ? 36.w : 28.w,
height: controller.currentIndex.value == e.key ? 36.w : 28.w,
);
}),
),
);
}).toList(),
),
),
);
}
}