From 1b37cbe1843af4477c9680702429200f908b67fe Mon Sep 17 00:00:00 2001 From: Sun Date: Sat, 9 Oct 2021 16:25:03 +0800 Subject: [PATCH] fix UI --- lib/pages/account_domain.dart | 153 +++++++++++++++++----------------- 1 file changed, 78 insertions(+), 75 deletions(-) diff --git a/lib/pages/account_domain.dart b/lib/pages/account_domain.dart index 223a222..db18b70 100644 --- a/lib/pages/account_domain.dart +++ b/lib/pages/account_domain.dart @@ -79,89 +79,92 @@ class AccountDomainScreenState extends State { ? this._providers[this._selected]! : ProviderServer.empty(); return Scaffold( - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - RichText( - text: TextSpan( - text: lang.register + ' ', - style: TextStyle( - color: color.onSurface, fontSize: 20.0, fontWeight: FontWeight.bold - ), - children: [ - TextSpan(text: widget.name, style: TextStyle(color: Color(0xFF6174FF))), - TextSpan(text: ' -> '), - TextSpan(text: provider.name, - style: TextStyle(color: Color(0xFF6174FF), fontStyle: FontStyle.italic) + body: Padding( + padding: const EdgeInsets.all(20.0), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + RichText( + text: TextSpan( + text: lang.register + ' ', + style: TextStyle( + color: color.onSurface, fontSize: 20.0, fontWeight: FontWeight.bold ), - TextSpan(text: ' ?'), - ], + children: [ + TextSpan(text: widget.name, style: TextStyle(color: Color(0xFF6174FF))), + TextSpan(text: ' -> '), + TextSpan(text: provider.name, + style: TextStyle(color: Color(0xFF6174FF), fontStyle: FontStyle.italic) + ), + TextSpan(text: ' ?'), + ], + ), ), - ), - const SizedBox(height: 10.0), - Container( - width: 600.0, - child: Text(lang.domainCreateTip), - ), - SizedBox( - height: 40.0, - child: Center(child: Text(this._exist ? lang.domainRegisterFailure : '', - style: TextStyle(color: Colors.red))), - ), - if (this._showName) - Container( - width: 600.0, - height: 50.0, - padding: const EdgeInsets.symmetric(horizontal: 20.0), - decoration: BoxDecoration( - color: color.surface, - border: Border.all( - color: _nameFocus.hasFocus ? color.primary : color.surface), - borderRadius: BorderRadius.circular(10.0), + const SizedBox(height: 10.0), + Container( + width: 600.0, + child: Text(lang.domainCreateTip), ), - child: TextField( - style: TextStyle(fontSize: 16.0), - decoration: InputDecoration( - border: InputBorder.none, - hintText: lang.domainName, - ), - controller: _nameController, - focusNode: _nameFocus + SizedBox( + height: 40.0, + child: Center(child: Text(this._exist ? lang.domainRegisterFailure : '', + style: TextStyle(color: Colors.red))), ), - ), - const SizedBox(height: 20.0), - ButtonText( - enable: this._providers.length > 0 && !this._waiting, - text: this._waiting ? lang.waiting : lang.send, - action: () { - final name = _nameController.text.trim(); - if (name.length > 0) { - rpc.send('domain-register', [provider.id, provider.addr, name, '']); - setState(() { - this._waiting = true; - this._exist = false; - }); - } - }), - const SizedBox(height: 20.0), - InkWell( - child: Container( + if (this._showName) + Container( width: 600.0, height: 50.0, + padding: const EdgeInsets.symmetric(horizontal: 20.0), decoration: BoxDecoration( - border: Border.all(color: Color(0xFF6174FF)), - borderRadius: BorderRadius.circular(10.0)), - child: Center(child: Text(lang.skip, style: TextStyle( - fontSize: 20.0, color: Color(0xFF6174FF) - ))), + color: color.surface, + border: Border.all( + color: _nameFocus.hasFocus ? color.primary : color.surface), + borderRadius: BorderRadius.circular(10.0), + ), + child: TextField( + style: TextStyle(fontSize: 16.0), + decoration: InputDecoration( + border: InputBorder.none, + hintText: lang.domainName, + ), + controller: _nameController, + focusNode: _nameFocus + ), + ), + const SizedBox(height: 20.0), + ButtonText( + enable: this._providers.length > 0 && !this._waiting, + text: this._waiting ? lang.waiting : lang.send, + action: () { + final name = _nameController.text.trim(); + if (name.length > 0) { + rpc.send('domain-register', [provider.id, provider.addr, name, '']); + setState(() { + this._waiting = true; + this._exist = false; + }); + } + }), + const SizedBox(height: 20.0), + InkWell( + child: Container( + width: 600.0, + height: 50.0, + decoration: BoxDecoration( + border: Border.all(color: Color(0xFF6174FF)), + borderRadius: BorderRadius.circular(10.0)), + child: Center(child: Text(lang.skip, style: TextStyle( + fontSize: 20.0, color: Color(0xFF6174FF) + ))), + ), + onTap: () { + Navigator.of(context).pushNamedAndRemoveUntil("/", (Route route) => false); + } ), - onTap: () { - Navigator.of(context).pushNamedAndRemoveUntil("/", (Route route) => false); - } - ), - ] + ] + ) ) ) );