| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:get/get.dart';
- import 'package:keyboard/base/base_page.dart';
- import 'package:keyboard/module/change/nickname/change_nickname_controller.dart';
- import 'package:keyboard/utils/styles.dart';
- import '../../../resource/assets.gen.dart';
- import '../../../router/app_pages.dart';
- class ChangeNicknamePage extends BasePage<ChangeNicknameController> {
- const ChangeNicknamePage({super.key});
- static Future start({String? nickName}) async {
- return Get.toNamed(
- RoutePath.changeNickname,
- arguments: {"nickName": nickName},
- );
- }
- @override
- bool immersive() {
- return true;
- }
- @override
- Color backgroundColor() {
- return const Color(0xFFF6F5FA);
- }
- @override
- Widget buildBody(BuildContext context) {
- return Stack(
- children: [
- IgnorePointer(child: Assets.images.bgMine.image(width: 360.w)),
- SafeArea(
- child: Stack(
- children: [
- SingleChildScrollView(
- child: Column(
- children: [
- _buildTitle(),
- SizedBox(height: 40.h),
- _buildContent(),
- ],
- ),
- ),
- Align(
- alignment: Alignment.bottomCenter,
- child: Container(
- margin: EdgeInsets.only(bottom: 32.h),
- child: Obx(() {
- return _buildSaveButton(
- onTap: () {
- controller.clickSave();
- },
- isEnable: controller.nickname.value.isNotEmpty,
- );
- }),
- ),
- ),
- ],
- ),
- ),
- ],
- );
- }
- _buildTitle() {
- return Container(
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(top: 12.h, left: 16.w, right: 16.w),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- GestureDetector(
- onTap: controller.clickBack,
- child: Assets.images.iconMineBackArrow.image(
- width: 24.w,
- height: 24.w,
- ),
- ),
- ],
- ),
- );
- }
- _buildContent() {
- return Column(
- children: [
- Text('修改昵称', style: Styles.getTextStyleBlack204W500(22.sp)),
- Container(
- margin: EdgeInsets.only(top: 119.h, left: 27.w, right: 27.w),
- alignment: Alignment.center,
- child: Container(
- height: 48.h,
- alignment: Alignment.center,
- child: TextField(
- controller: controller.textEditingController,
- // maxLength: maxLength,
- maxLines: 1,
- onChanged: (value) {
- controller.nickname.value = value;
- },
- cursorColor: Color(0xFF7B7DFF),
- textAlign: TextAlign.center,
- textAlignVertical: TextAlignVertical.center,
- decoration: InputDecoration(
- counterText: "",
- hintText: "请输入你的昵称",
- hintStyle: TextStyle(
- color: Colors.black.withAlpha(77),
- fontSize: 18.sp,
- fontWeight: FontWeight.w500,
- ),
- border: UnderlineInputBorder(
- borderSide: BorderSide(
- color: Colors.black.withAlpha(26),
- width: 1.w,
- ),
- ),
- focusedBorder: UnderlineInputBorder(
- borderSide: BorderSide(
- color: Colors.black.withAlpha(26),
- width: 1.w,
- ),
- ),
- filled: true,
- fillColor: Colors.transparent,
- ),
- ),
- ),
- ),
- ],
- );
- }
- Widget _buildSaveButton({required VoidCallback onTap, required isEnable}) {
- return GestureDetector(
- onTap: () {
- onTap();
- },
- child: Container(
- width: 260.w,
- height: 48.h,
- decoration:
- isEnable
- ? Styles.getActivateButtonDecoration(31.r)
- : Styles.getInactiveButtonDecoration(31.r),
- child: Center(
- child: Text(
- '保存',
- style: TextStyle(
- color: Colors.white,
- fontSize: 16.sp,
- fontWeight: FontWeight.w500,
- ),
- ),
- ),
- ),
- );
- }
- }
|