import 'package:chat/controllers/moment_controller.dart';
import 'package:chat/views/moments/index/widgets/moment_list_item.dart';
import 'package:chat/views/moments/index/widgets/moment_list_reply.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class MomentDetailPage extends StatelessWidget {
  const MomentDetailPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final ctrl = MomentController.to;
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: () => FocusScope.of(context).unfocus(),
      child: Scaffold(
        appBar: AppBar(
          title: const Text('动态详情'),
          // actions: [
          //   PopupMenuButton(
          //     itemBuilder: (context) => [
          //       const PopupMenuItem(
          //         child: Text(''),
          //       ),
          //     ],
          //   )
          // ],
        ),
        body: SafeArea(
          child: SingleChildScrollView(
            child: Obx(() {
              final item =
                  ctrl.momentData.value!.data![ctrl.currentMomentIndex];
              return Column(
                children: [
                  MomentListItem(item: item),
                  MomentListItemReplay(
                    index: 0,
                    item: item,
                    reply: (value) => MomentController.to
                        .showReplyBar(item.dynamicId!, value),
                  ),
                  const SizedBox(height: 16),
                ],
              );
            }),
          ),
        ),
      ),
    );
  }
}
