aslan-flutter/lib/chatvibe_ui/widgets/room/room_membership_fee_page.dart
2026-07-01 18:25:58 +08:00

242 lines
12 KiB
Dart

import 'dart:ui' as ui;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:aslan/chatvibe_data/sources/repositories/room_repository_imp.dart';
import 'package:aslan/chatvibe_managers/rtc_manager.dart';
import 'package:provider/provider.dart';
import 'package:aslan/app_localizations.dart';
import 'package:aslan/chatvibe_ui/components/text/at_text.dart';
class RoomMembershipFeePage extends StatefulWidget {
@override
_RoomMembershipFeePageState createState() => _RoomMembershipFeePageState();
}
class _RoomMembershipFeePageState extends State<RoomMembershipFeePage> {
final TextEditingController _roomFeeController = TextEditingController();
@override
void initState() {
super.initState();
_roomFeeController.text =
"${Provider.of<RtcProvider>(context, listen: false).currenRoom?.roomProfile?.roomSetting?.joinGolds}";
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: Colors.transparent,
body: Stack(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.pop(context);
},
child: SizedBox(
width: ScreenUtil().screenWidth,
height: ScreenUtil().screenHeight,
),
),
Column(
children: [
Spacer(),
ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(12.0),
topRight: Radius.circular(12.0),
),
child: BackdropFilter(
filter: ui.ImageFilter.blur(sigmaX: 15, sigmaY: 15),
child: Material(
color: Colors.black54,
child: Container(
width: ScreenUtil().screenWidth,
padding: EdgeInsets.all(15.w),
child: Stack(
children: [
Column(
children: [
text(
ATAppLocalizations.of(context)!.membershipFee,
fontSize: 16.sp,
textColor: Colors.white,
),
SizedBox(height: 15.w),
text(
maxLines: 5,
ATAppLocalizations.of(
context,
)!.membershipFeeTips1,
fontSize: 14.sp,
textColor: Colors.white54,
),
SizedBox(height: 15.w),
Container(
padding: EdgeInsets.only(
left: 12.w,
right: 12.w,
),
alignment: Alignment.centerLeft,
height: 45.w,
width: 150.w,
decoration: BoxDecoration(
color: Colors.white30,
borderRadius: BorderRadius.all(
Radius.circular(8.w),
),
),
child: TextField(
controller: _roomFeeController,
textAlign: TextAlign.center,
maxLength: 5,
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintStyle: TextStyle(
color: Colors.black45,
fontSize: 14.sp,
),
contentPadding: EdgeInsets.only(top: 0.w),
counterText: '',
isDense: true,
filled: false,
focusColor: Colors.transparent,
hoverColor: Colors.transparent,
border: InputBorder.none,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
disabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
// enabledBorder: UnderlineInputBorder(
// borderSide: BorderSide(width: 0.5,color: Colors.white,style: BorderStyle.solid),),
// focusedBorder: UnderlineInputBorder(
// borderSide: BorderSide(width: 0.5,color: Colors.white,style: BorderStyle.solid),),
// prefixIcon: Padding(padding: EdgeInsets.all(8.w), child: Image.asset("images/login/at_icon_phone.png",width: 20.w, height: 20.w,fit: BoxFit.fill,),),
fillColor: Colors.black45,
),
style: TextStyle(
fontSize: 15.sp,
color: Colors.white,
textBaseline: TextBaseline.alphabetic,
),
),
),
SizedBox(height: 15.w),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
text(
ATAppLocalizations.of(context)!.freePrice,
fontSize: 14.sp,
textColor: Colors.white,
),
Image.asset(
"atu_images/general/at_icon_jb.png",
width: 15.w,
height: 15.w,
),
],
),
SizedBox(height: 15.w),
text(
maxLines: 5,
ATAppLocalizations.of(
context,
)!.membershipFeeTips2,
fontSize: 14.sp,
textColor: Colors.white54,
),
SizedBox(height: 15.w),
GestureDetector(
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(35.w),
color: Colors.white30,
),
height: 45.w,
width: 140.w,
child: text(
ATAppLocalizations.of(context)!.save,
fontSize: 16.sp,
fontWeight: FontWeight.w600,
textColor: Colors.white,
),
),
onTap: () {
if (_roomFeeController.text.isEmpty) {
_roomFeeController.text = "0";
}
ChatRoomRepository()
.updateRoomSetting(
Provider.of<RtcProvider>(
context,
listen: false,
)
.currenRoom
?.roomProfile
?.roomProfile
?.id ??
"",
Provider.of<RtcProvider>(
context,
listen: false,
)
.currenRoom
?.roomProfile
?.roomProfile
?.roomAccount ??
"",
context,
joinGolds: _roomFeeController.text,
)
.whenComplete(() {
Provider.of<RtcProvider>(
context,
listen: false,
).loadRoomInfo(
Provider.of<RtcProvider>(
context,
listen: false,
)
.currenRoom
?.roomProfile
?.roomProfile
?.id ??
"",
);
Navigator.pop(context);
});
},
),
],
),
GestureDetector(
child: Icon(
Icons.close,
size: 15.w,
color: Colors.white,
),
onTap: () {
Navigator.pop(context);
},
),
],
),
),
),
),
),
],
),
],
),
),
);
}
}