|
|
@ -17,6 +17,7 @@ import 'package:esse/global.dart'; |
|
|
|
import 'package:esse/provider.dart'; |
|
|
|
import 'package:esse/provider.dart'; |
|
|
|
|
|
|
|
|
|
|
|
import 'package:esse/apps/chat/models.dart'; |
|
|
|
import 'package:esse/apps/chat/models.dart'; |
|
|
|
|
|
|
|
import 'package:esse/apps/chat/list.dart'; |
|
|
|
import 'package:esse/apps/chat/provider.dart'; |
|
|
|
import 'package:esse/apps/chat/provider.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class ChatAddPage extends StatefulWidget { |
|
|
|
class ChatAddPage extends StatefulWidget { |
|
|
@ -31,7 +32,6 @@ class ChatAddPage extends StatefulWidget { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class _ChatAddPageState extends State<ChatAddPage> { |
|
|
|
class _ChatAddPageState extends State<ChatAddPage> { |
|
|
|
final _formKey = GlobalKey<FormState>(); |
|
|
|
|
|
|
|
TextEditingController userIdEditingController = TextEditingController(); |
|
|
|
TextEditingController userIdEditingController = TextEditingController(); |
|
|
|
TextEditingController addrEditingController = TextEditingController(); |
|
|
|
TextEditingController addrEditingController = TextEditingController(); |
|
|
|
TextEditingController remarkEditingController = TextEditingController(); |
|
|
|
TextEditingController remarkEditingController = TextEditingController(); |
|
|
@ -115,113 +115,101 @@ class _ChatAddPageState extends State<ChatAddPage> { |
|
|
|
final requestKeys = requests.keys.toList().reversed.toList(); // it had sorted. |
|
|
|
final requestKeys = requests.keys.toList().reversed.toList(); // it had sorted. |
|
|
|
|
|
|
|
|
|
|
|
return Scaffold( |
|
|
|
return Scaffold( |
|
|
|
body: SafeArea( |
|
|
|
appBar: AppBar( |
|
|
|
child: Padding( |
|
|
|
title: Text(lang.addFriend), |
|
|
|
padding: const EdgeInsets.all(10.0), |
|
|
|
bottom: PreferredSize( |
|
|
|
child: Column(children: <Widget>[ |
|
|
|
child: Container(color: const Color(0x40ADB0BB), height: 1.0), |
|
|
|
Row( |
|
|
|
preferredSize: Size.fromHeight(1.0) |
|
|
|
children: [ |
|
|
|
), |
|
|
|
if (!isDesktop) |
|
|
|
leading: isDesktop |
|
|
|
GestureDetector( |
|
|
|
? IconButton( |
|
|
|
onTap: () { |
|
|
|
onPressed: () { |
|
|
|
context.read<ChatProvider>().requestClear(); |
|
|
|
context.read<ChatProvider>().requestClear(); |
|
|
|
Navigator.pop(context); |
|
|
|
context.read<AccountProvider>().updateActivedWidget(ChatList()); |
|
|
|
}, |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
icon: Icon(Icons.arrow_back, color: color.primary), |
|
|
|
width: 20.0, |
|
|
|
) : null, |
|
|
|
child: Icon(Icons.arrow_back, color: color.primary)), |
|
|
|
actions: [ |
|
|
|
), |
|
|
|
TextButton( |
|
|
|
SizedBox(width: 15.0), |
|
|
|
onPressed: () => showShadowDialog( |
|
|
|
Expanded( |
|
|
|
context, |
|
|
|
child: Text(lang.addFriend, |
|
|
|
Icons.info, |
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0)), |
|
|
|
lang.info, |
|
|
|
), |
|
|
|
UserInfo(app: 'add-friend', |
|
|
|
TextButton( |
|
|
|
id: account.id, name: account.name, addr: Global.addr) |
|
|
|
onPressed: () => showShadowDialog( |
|
|
|
), |
|
|
|
context, |
|
|
|
child: Text(lang.myQrcode, style: TextStyle(fontSize: 16.0)), |
|
|
|
Icons.info, |
|
|
|
), |
|
|
|
lang.info, |
|
|
|
] |
|
|
|
UserInfo(app: 'add-friend', |
|
|
|
), |
|
|
|
id: account.id, name: account.name, addr: Global.addr) |
|
|
|
body: Container( |
|
|
|
), |
|
|
|
padding: const EdgeInsets.all(10.0), |
|
|
|
child: Text(lang.myQrcode, style: TextStyle(fontSize: 16.0)), |
|
|
|
alignment: Alignment.topCenter, |
|
|
|
), |
|
|
|
child: SingleChildScrollView( |
|
|
|
], |
|
|
|
child: Container( |
|
|
|
), |
|
|
|
width: 600, |
|
|
|
isDesktop ? SizedBox(height: 20.0) : SizedBox(height: 50.0), |
|
|
|
padding: const EdgeInsets.all(20), |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
child: SingleChildScrollView( |
|
|
|
children: <Widget>[ |
|
|
|
child: Container( |
|
|
|
Container( |
|
|
|
constraints: BoxConstraints(minWidth: 200, maxWidth: 600), |
|
|
|
child: Row( |
|
|
|
padding: const EdgeInsets.all(20), |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
|
|
|
child: Form( |
|
|
|
children: [ |
|
|
|
key: _formKey, |
|
|
|
ShadowButton( |
|
|
|
child: Column( |
|
|
|
icon: Icons.camera_alt, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
color: color, |
|
|
|
children: <Widget>[ |
|
|
|
text: lang.scanQr, |
|
|
|
Container( |
|
|
|
action: () => Navigator.push( |
|
|
|
child: Row( |
|
|
|
context, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
|
|
|
MaterialPageRoute(builder: (context) => QRScan(callback: scanCallback)) |
|
|
|
children: [ |
|
|
|
)), |
|
|
|
ShadowButton( |
|
|
|
if (MediaQuery.of(context).size.width < 400) Spacer(), |
|
|
|
icon: Icons.camera_alt, |
|
|
|
ShadowButton( |
|
|
|
color: color, |
|
|
|
icon: Icons.image, |
|
|
|
text: lang.scanQr, |
|
|
|
color: color, |
|
|
|
action: () => Navigator.push( |
|
|
|
text: lang.scanImage, |
|
|
|
context, |
|
|
|
action: chooseImage), |
|
|
|
MaterialPageRoute(builder: (context) => QRScan(callback: scanCallback)) |
|
|
|
], |
|
|
|
)), |
|
|
|
|
|
|
|
if (MediaQuery.of(context).size.width < 400) Spacer(), |
|
|
|
|
|
|
|
ShadowButton( |
|
|
|
|
|
|
|
icon: Icons.image, |
|
|
|
|
|
|
|
color: color, |
|
|
|
|
|
|
|
text: lang.scanImage, |
|
|
|
|
|
|
|
action: chooseImage), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
const SizedBox(height: 40.0), |
|
|
|
|
|
|
|
InputText( |
|
|
|
|
|
|
|
icon: Icons.person, |
|
|
|
|
|
|
|
text: lang.id, |
|
|
|
|
|
|
|
controller: userIdEditingController, |
|
|
|
|
|
|
|
focus: userIdFocus), |
|
|
|
|
|
|
|
const SizedBox(height: 20.0), |
|
|
|
|
|
|
|
InputText( |
|
|
|
|
|
|
|
icon: Icons.location_on, |
|
|
|
|
|
|
|
text: lang.address, |
|
|
|
|
|
|
|
controller: addrEditingController, |
|
|
|
|
|
|
|
focus: addrFocus), |
|
|
|
|
|
|
|
const SizedBox(height: 20.0), |
|
|
|
|
|
|
|
InputText( |
|
|
|
|
|
|
|
icon: Icons.turned_in, |
|
|
|
|
|
|
|
text: lang.remark, |
|
|
|
|
|
|
|
controller: remarkEditingController, |
|
|
|
|
|
|
|
focus: remarkFocus), |
|
|
|
|
|
|
|
const SizedBox(height: 20.0), |
|
|
|
|
|
|
|
ButtonText(action: send, text: lang.send, width: 600.0), |
|
|
|
|
|
|
|
const SizedBox(height: 20.0), |
|
|
|
|
|
|
|
const Divider(height: 1.0, color: Color(0x40ADB0BB)), |
|
|
|
|
|
|
|
const SizedBox(height: 10.0), |
|
|
|
|
|
|
|
if (requests.isNotEmpty) |
|
|
|
|
|
|
|
ListView.builder( |
|
|
|
|
|
|
|
itemCount: requestKeys.length, |
|
|
|
|
|
|
|
shrinkWrap: true, |
|
|
|
|
|
|
|
physics: ClampingScrollPhysics(), |
|
|
|
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
|
|
|
|
itemBuilder: (BuildContext context, int index) => |
|
|
|
|
|
|
|
_RequestItem(request: requests[requestKeys[index]]), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
const SizedBox(height: 40.0), |
|
|
|
] |
|
|
|
InputText( |
|
|
|
) |
|
|
|
icon: Icons.person, |
|
|
|
) |
|
|
|
text: lang.id, |
|
|
|
)); |
|
|
|
controller: userIdEditingController, |
|
|
|
|
|
|
|
focus: userIdFocus), |
|
|
|
|
|
|
|
const SizedBox(height: 20.0), |
|
|
|
|
|
|
|
InputText( |
|
|
|
|
|
|
|
icon: Icons.location_on, |
|
|
|
|
|
|
|
text: lang.address, |
|
|
|
|
|
|
|
controller: addrEditingController, |
|
|
|
|
|
|
|
focus: addrFocus), |
|
|
|
|
|
|
|
const SizedBox(height: 20.0), |
|
|
|
|
|
|
|
InputText( |
|
|
|
|
|
|
|
icon: Icons.turned_in, |
|
|
|
|
|
|
|
text: lang.remark, |
|
|
|
|
|
|
|
controller: remarkEditingController, |
|
|
|
|
|
|
|
focus: remarkFocus), |
|
|
|
|
|
|
|
const SizedBox(height: 20.0), |
|
|
|
|
|
|
|
ButtonText(action: send, text: lang.send, width: 600.0), |
|
|
|
|
|
|
|
const SizedBox(height: 20.0), |
|
|
|
|
|
|
|
const Divider(height: 1.0, color: Color(0x40ADB0BB)), |
|
|
|
|
|
|
|
const SizedBox(height: 10.0), |
|
|
|
|
|
|
|
if (requests.isNotEmpty) |
|
|
|
|
|
|
|
ListView.builder( |
|
|
|
|
|
|
|
itemCount: requestKeys.length, |
|
|
|
|
|
|
|
shrinkWrap: true, |
|
|
|
|
|
|
|
physics: ClampingScrollPhysics(), |
|
|
|
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
|
|
|
|
itemBuilder: (BuildContext context, int index) => |
|
|
|
|
|
|
|
_RequestItem(request: requests[requestKeys[index]]), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|