import 'dart:convert';
import 'dart:ui' as ui;

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:yumi/app_localizations.dart';
import 'package:yumi/ui_kit/components/text/sc_text.dart';
import 'package:provider/provider.dart';
import 'package:yumi/app/constants/sc_screen.dart';
import 'package:yumi/services/audio/rtc_manager.dart';
import 'package:yumi/ui_kit/theme/socialchat_theme.dart';

class SCEditRoomAnnouncementPage extends StatefulWidget {
  @override
  _SCEditRoomAnnouncementPageState createState() =>
      _SCEditRoomAnnouncementPageState();
}

class _SCEditRoomAnnouncementPageState extends State<SCEditRoomAnnouncementPage> {

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return ClipRRect(
      borderRadius: BorderRadius.all(Radius.circular(12.w)),
      child: BackdropFilter(
        filter: ui.ImageFilter.blur(sigmaX: 15, sigmaY: 15),
        child: Container(
          width: ScreenUtil().screenWidth * 0.75,
          padding: EdgeInsets.symmetric(horizontal: 10.w),
          decoration: BoxDecoration(color: Color(0XFF09372E).withOpacity(0.5)),
          child: Stack(
            alignment: Alignment.center,
            children: [
              Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  SizedBox(height: 15.w),
                  text(
                    SCAppLocalizations.of(context)!.roomAnnouncement,
                    fontSize: 16.sp,
                    fontWeight: FontWeight.w600,
                    textColor: Colors.white,
                  ),
                  SizedBox(height: 10.w),
                  Row(
                    children: [
                      Expanded(
                        child: Container(
                          margin: EdgeInsets.symmetric(horizontal: 15.w),
                          padding: EdgeInsets.only(
                            top: 5.w,
                            bottom: 10.w,
                            left: width(12),
                            right: width(12),
                          ),
                          alignment: AlignmentDirectional.centerStart,
                          height: 110.w,
                          width: ScreenUtil().screenWidth,
                          decoration: BoxDecoration(
                            color: Colors.transparent,
                            borderRadius: BorderRadius.all(
                              Radius.circular(height(8)),
                            ),
                            border: Border.all(
                              color: SocialChatTheme.primaryLight,
                              width: 0.5.w,
                            ),
                          ),
                          child: SingleChildScrollView(
                            child: Text(
                              Provider.of<RtcProvider>(context, listen: false)
                                      .currenRoom
                                      ?.roomProfile
                                      ?.roomProfile
                                      ?.roomDesc ??
                                  "",
                              style: TextStyle(
                                fontSize: sp(12),
                                color: Colors.white,
                                textBaseline: TextBaseline.alphabetic,
                              ),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  SizedBox(height: 25.w),
                ],
              ),
              PositionedDirectional(
                top: 10.w,
                end: 10.w,
                child: GestureDetector(
                  child: Icon(Icons.close, color: Colors.white, size: 18.w),
                  onTap: () {
                    SmartDialog.dismiss(tag: "showEditNotiPage");
                  },
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
