watch_theme_view.dart 3.38 KB
import 'package:doublefeel_flutter/app/modules/watch_theme/models/watch_theme_models.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';

import '../controllers/watch_theme_controller.dart';
import '../widgets/custom_theme_card.dart';
import '../widgets/official_theme_grid.dart';
import '../widgets/watch_theme_colors.dart';
import '../widgets/watch_theme_header.dart';
import '../widgets/watch_theme_nav_bar.dart';

class WatchThemeView extends GetView<WatchThemeController> {
  const WatchThemeView({super.key});

  @override
  Widget build(BuildContext context) {
    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: const SystemUiOverlayStyle(
        statusBarColor: Colors.transparent,
        statusBarIconBrightness: Brightness.dark,
        statusBarBrightness: Brightness.light,
        systemNavigationBarColor: WatchThemeColors.background,
        systemNavigationBarIconBrightness: Brightness.dark,
      ),
      child: Scaffold(
        backgroundColor: WatchThemeColors.background,
        body: Stack(
          children: [
            const Positioned(
              left: 0,
              right: 0,
              top: 0,
              height: 300,
              child: DecoratedBox(
                decoration: BoxDecoration(
                  gradient: LinearGradient(
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter,
                    colors: [
                      WatchThemeColors.gradientTop,
                      WatchThemeColors.background,
                    ],
                  ),
                ),
              ),
            ),
            SafeArea(
              bottom: false,
              child: Column(
                children: [
                  WatchThemeNavBar(
                    title: 'Watch主题',
                    onBack: controller.executeBackLogic,
                  ),
                  Expanded(
                    child: Obx(
                      () => SingleChildScrollView(
                        physics: const BouncingScrollPhysics(),
                        padding: const EdgeInsets.only(bottom: 24),
                        child: Column(
                          children: [
                            const WatchThemeHeader(),
                            const SizedBox(height: 26),
                            OfficialThemeGrid(
                              themes: officialThemes,
                              selectedIndex:
                                  controller.selectedOfficialIndex.value,
                              onThemeTap: controller.selectOfficialTheme,
                            ),
                            const SizedBox(height: 12),
                            CustomThemeCard(
                              isPremium: controller.isPremium.value,
                              hasCustomThemes: controller.hasCustomThemes.value,
                              customThemes: customThemes,
                              onCreateTap: controller.createCustomTheme,
                              onThemeTap: (_) =>
                                  controller.previewCustomTheme(),
                            ),
                          ],
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}