import 'package:flutter/material.dart';
import 'package:initial_folder/models/announcement_model.dart';
import 'package:initial_folder/models/reply_announcement_model.dart';
import '../size_config.dart';
import '../theme.dart';

class ReplyAnnouncementUser extends StatefulWidget {
  const ReplyAnnouncementUser(
      {Key? key,
      required this.announcementDataModel,
      required this.divider,
      required this.replyModel,
      required this.userId})
      : super(key: key);

  final Widget? divider;
  final ReplyModel replyModel;
  final int userId;
  final AnnouncementDataModel announcementDataModel;
  @override
  State<ReplyAnnouncementUser> createState() => _ReplyAnnouncementUserState();
}

class _ReplyAnnouncementUserState extends State<ReplyAnnouncementUser> {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.symmetric(
        horizontal: getProportionateScreenWidth(16),
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              SizedBox(
                height: 6,
              ),
              Row(
                children: [
                  CircleAvatar(
                    backgroundColor: primaryColor,
                    backgroundImage: widget.replyModel.fotoProfile == null
                        ? AssetImage("assets/images/Profile Image.png")
                        : NetworkImage(widget.replyModel.fotoProfile ?? '')
                            as ImageProvider,
                  ),
                  SizedBox(width: getProportionateScreenWidth(8)),
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Row(
                        children: [
                          InkWell(
                            onTap: () {
                              print(
                                  'Print ${widget.announcementDataModel.tokenAnnouncement}');
                            },
                            child: Text(
                              widget.replyModel.name ?? '',
                              style: thirdTextStyle.copyWith(
                                  fontSize: getProportionateScreenWidth(12),
                                  color: Theme.of(context)
                                      .colorScheme
                                      .onBackground),
                            ),
                          ),
                        ],
                      ),
                      Text(
                        widget.replyModel.createAt ?? '',
                        style: primaryTextStyle.copyWith(
                            fontSize: getProportionateScreenWidth(12),
                            color: Theme.of(context).colorScheme.onBackground),
                      ),
                    ],
                  ),
                ],
              ),
              SizedBox(height: getProportionateScreenHeight(8)),
              Text(
                widget.replyModel.body ?? '',
                style: thirdTextStyle.copyWith(
                    color: Theme.of(context).colorScheme.onBackground,
                    letterSpacing: 1,
                    fontSize: SizeConfig.blockHorizontal! * 3.4),
              ),
            ],
          ),
          SizedBox(height: getProportionateScreenHeight(6)),
          // SizedBox(child: widget.divider)
          Divider(
            thickness: 0.3,
          )
        ],
      ),
    );
  }
}
