poem_detail.dart 6.61 KB
import 'dart:ui';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:one_poem/res/gaps.dart';
import 'package:one_poem/widgets/bars/home_action_bar.dart';
import 'package:one_poem/widgets/bars/home_menu_bar.dart';
import 'package:one_poem/widgets/my_app_bar.dart';

class PoemDetailPage extends StatefulWidget {
  const PoemDetailPage({
    Key? key,
    this.onPop,
    required this.poemId,
    this.poemPanelHeight = 0,
  }) : super(key: key);

  final int poemId;
  final int poemPanelHeight;
  final Function? onPop;

  @override
  _PoemDetailPageState createState() => _PoemDetailPageState();
}

class _PoemDetailPageState extends State<PoemDetailPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MyAppBar(
        isBack: true,
        isTransparent: false,
        homeMenuHeader: HomeMenuHeader(
          funcLeft: () {
            print("lefltlelfle poem id=" + widget.poemId.toString());
          },
        ),
        homeActionWidgets: HomeActionWidgets(
          funcStar: () {
            print("starrrrrrr");
          },
        ),
      ),
      body: Container(
        alignment: Alignment.topCenter,
        decoration: const BoxDecoration(
          image: DecorationImage(
            image: AssetImage("assets/images/poem/poem_background.png"),
            fit: BoxFit.fill,
          ),
        ),
        child: SafeArea(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                margin: const EdgeInsets.symmetric(
                    vertical: 30.0, horizontal: 20.0),
                height: MediaQuery.of(context).size.height - 140 - widget.poemPanelHeight,
                width: double.infinity,
                decoration: BoxDecoration(
                  color: Colors.grey.shade200.withOpacity(0.1),
                  border: Border.all(color: Colors.grey.shade50, width: 0.5), // 边色与边宽度
                  // borderRadius: BorderRadius.circular(2.0),
                ),
                child: ClipRect(
                  child: BackdropFilter(
                    filter: ImageFilter.blur(
                      sigmaX: 10.0,
                      sigmaY: 10.0,
                    ),
                    child: Container(
                      decoration: BoxDecoration(
                        color: Colors.grey.shade200.withOpacity(0.1),
                      ),
                      child: Padding(
                        padding: const EdgeInsets.all(10.0),
                        child: Column(
                          children: [
                            const Text(
                              "题破山寺后禅院",
                              style: TextStyle(
                                fontSize: 24.0,
                                color: Colors.white,
                              ),
                            ),
                            Gaps.vGap16,
                            const Text(
                              "常建",
                              style: TextStyle(
                                fontSize: 18.0,
                                color: Colors.white,
                              ),
                            ),
                            Gaps.vGap12,
                            const Text(
                              "清晨入古寺,初日照高林。\n竹径通幽处,禅房花木深。\n山光悦鸟性,潭影空人心。\n万籁此都寂,但余钟磬音。",
                              style: TextStyle(
                                  color: Colors.white,
                                  fontFamily: "ZCOOLXiaoWei",
                                  fontSize: 24.0),
                            ),
                            Gaps.vGap24,
                            Container(
                              alignment: Alignment.centerLeft,
                              padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0),
                              child: const Text(
                                "100位用户朗读录制提交了“临境”",
                                style: TextStyle(color: Colors.white, fontSize: 15.0),
                              ),
                            ),
                            Expanded(
                              child: Container(
                                padding: const EdgeInsets.symmetric(
                                    vertical: 5.0, horizontal: 10.0),
                                width: double.infinity,
                                child: ListView.builder(
                                    itemBuilder: (BuildContext context, int index) {
                                      return Wrap(
                                        spacing: 5.0,
                                        crossAxisAlignment: WrapCrossAlignment.center,
                                        children: const [
                                          Icon(
                                            Icons.play_circle_outline,
                                            size: 16.0,
                                          ),
                                          Text(
                                            "普通话",
                                            style: TextStyle(color: Colors.white, fontSize: 16.0),
                                          )
                                        ],
                                      );
                                    }),
                              ),
                            ),
                            Container(
                              width: double.infinity,
                              alignment: Alignment.center,
                              child: Row(
                                mainAxisSize: MainAxisSize.min,
                                children: [
                                  IconButton(
                                    icon: const Icon(Icons.mic_none, size: 36.0,),
                                    onPressed: () {},
                                  ),
                                  Gaps.hGap16,
                                  IconButton(
                                    icon: const Icon(Icons.camera_alt_outlined, size: 36.0,),
                                    onPressed: () {},
                                  )
                                ],
                              ),),
                          ],
                        ),
                      ),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}