mirror of
https://github.com/Linloir/Simple-TCP-Client.git
synced 2025-12-18 17:28:11 +08:00
Improvements:
- Improve display paddings, sizes & experiences on remote platforms
This commit is contained in:
parent
da53d22261
commit
5594bd6ba7
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-13 14:03:16
|
* @Date : 2022-10-13 14:03:16
|
||||||
* @LastEditTime : 2022-10-20 10:52:30
|
* @LastEditTime : 2022-10-22 21:30:04
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ class ChatPage extends StatelessWidget {
|
|||||||
//Return history tile
|
//Return history tile
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 24,
|
horizontal: 16,
|
||||||
vertical: 8
|
vertical: 8
|
||||||
),
|
),
|
||||||
child: HistoryTile(
|
child: HistoryTile(
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-13 14:03:56
|
* @Date : 2022-10-13 14:03:56
|
||||||
* @LastEditTime : 2022-10-20 11:04:40
|
* @LastEditTime : 2022-10-22 22:46:18
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-14 17:07:13
|
* @Date : 2022-10-14 17:07:13
|
||||||
* @LastEditTime : 2022-10-18 15:44:34
|
* @LastEditTime : 2022-10-22 23:31:19
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,7 +35,10 @@ class FileBox extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 0.0,
|
||||||
|
vertical: 6.0
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
@ -43,38 +46,38 @@ class FileBox extends StatelessWidget {
|
|||||||
child: history.status == ChatHistoryStatus.none || history.status == ChatHistoryStatus.done ?
|
child: history.status == ChatHistoryStatus.none || history.status == ChatHistoryStatus.done ?
|
||||||
Icon(
|
Icon(
|
||||||
Icons.file_present_rounded,
|
Icons.file_present_rounded,
|
||||||
size: 24,
|
size: 20,
|
||||||
color: history.type == ChatHistoryType.income ? Colors.blue[800] : Colors.white.withOpacity(0.8),
|
color: history.type == ChatHistoryType.income ? Colors.blue[800] : Colors.white.withOpacity(0.8),
|
||||||
) : history.status == ChatHistoryStatus.failed ?
|
) : history.status == ChatHistoryStatus.failed ?
|
||||||
Icon(
|
Icon(
|
||||||
Icons.refresh_rounded,
|
Icons.refresh_rounded,
|
||||||
size: 24,
|
size: 20,
|
||||||
color: history.type == ChatHistoryType.income ? Colors.red[800] : Colors.white.withOpacity(0.8),
|
color: history.type == ChatHistoryType.income ? Colors.red[800] : Colors.white.withOpacity(0.8),
|
||||||
) : history.status == ChatHistoryStatus.processing ?
|
) : history.status == ChatHistoryStatus.processing ?
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 18.0,
|
height: 16.0,
|
||||||
width: 18.0,
|
width: 16.0,
|
||||||
child: LoadingIndicator(
|
child: LoadingIndicator(
|
||||||
indicatorType: Indicator.ballPulseSync,
|
indicatorType: Indicator.ballPulseSync,
|
||||||
colors: [Colors.white.withOpacity(0.8)],
|
colors: [Colors.white.withOpacity(0.8)],
|
||||||
),
|
),
|
||||||
) :
|
) :
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 18.0,
|
height: 16.0,
|
||||||
width: 18.0,
|
width: 16.0,
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
color: history.type == ChatHistoryType.income ? Colors.blue[800] : Colors.white.withOpacity(0.8),
|
color: history.type == ChatHistoryType.income ? Colors.blue[800] : Colors.white.withOpacity(0.8),
|
||||||
strokeWidth: 3,
|
strokeWidth: 2.5,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
const SizedBox(width: 18.0,),
|
const SizedBox(width: 16.0,),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
history.message.contentDecoded,
|
history.message.contentDecoded,
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20.0,
|
fontSize: 16.0,
|
||||||
color: history.type == ChatHistoryType.income ? Colors.grey[900] : Colors.white
|
color: history.type == ChatHistoryType.income ? Colors.grey[900] : Colors.white
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-14 17:04:20
|
* @Date : 2022-10-14 17:04:20
|
||||||
* @LastEditTime : 2022-10-20 13:47:29
|
* @LastEditTime : 2022-10-22 23:05:24
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class ImageBox extends StatelessWidget {
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
constraints: const BoxConstraints(maxWidth: 500, maxHeight: 200),
|
constraints: const BoxConstraints(maxWidth: 200, maxHeight: 150),
|
||||||
child: history.preCachedImage ?? Image.memory(base64Decode(history.message.contentDecoded)),
|
child: history.preCachedImage ?? Image.memory(base64Decode(history.message.contentDecoded)),
|
||||||
),
|
),
|
||||||
Material(
|
Material(
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-14 17:04:12
|
* @Date : 2022-10-14 17:04:12
|
||||||
* @LastEditTime : 2022-10-15 10:53:28
|
* @LastEditTime : 2022-10-22 23:06:38
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -25,7 +25,10 @@ class TextBox extends StatelessWidget {
|
|||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: (){},
|
onTap: (){},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 0.0,
|
||||||
|
vertical: 6.0
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -35,14 +38,14 @@ class TextBox extends StatelessWidget {
|
|||||||
if(history.status == ChatHistoryStatus.sending)
|
if(history.status == ChatHistoryStatus.sending)
|
||||||
...[
|
...[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 15.0,
|
height: 12.0,
|
||||||
width: 15.0,
|
width: 12.0,
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
color: Colors.white.withOpacity(0.5),
|
color: Colors.white.withOpacity(0.5),
|
||||||
strokeWidth: 2.0,
|
strokeWidth: 2.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16.0,),
|
const SizedBox(width: 12.0,),
|
||||||
],
|
],
|
||||||
if(history.status == ChatHistoryStatus.failed)
|
if(history.status == ChatHistoryStatus.failed)
|
||||||
...[
|
...[
|
||||||
@ -53,7 +56,7 @@ class TextBox extends StatelessWidget {
|
|||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.error_rounded,
|
Icons.error_rounded,
|
||||||
color: Colors.white.withOpacity(0.5),
|
color: Colors.white.withOpacity(0.5),
|
||||||
size: 20,
|
size: 18,
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
context.read<ChatCubit>().tcpRepository.pushRequest(SendMessageRequest(
|
context.read<ChatCubit>().tcpRepository.pushRequest(SendMessageRequest(
|
||||||
@ -64,16 +67,16 @@ class TextBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8.0,),
|
const SizedBox(width: 6.0,),
|
||||||
],
|
],
|
||||||
if(history.status == ChatHistoryStatus.done)
|
if(history.status == ChatHistoryStatus.done)
|
||||||
...[
|
...[
|
||||||
Icon(
|
Icon(
|
||||||
Icons.check_rounded,
|
Icons.check_rounded,
|
||||||
color: Colors.white.withOpacity(0.5),
|
color: Colors.white.withOpacity(0.5),
|
||||||
size: 20,
|
size: 18,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12.0,),
|
const SizedBox(width: 8.0,),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
Flexible(
|
Flexible(
|
||||||
@ -81,7 +84,7 @@ class TextBox extends StatelessWidget {
|
|||||||
history.message.contentDecoded,
|
history.message.contentDecoded,
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 16,
|
||||||
color: history.type == ChatHistoryType.income ? Colors.grey[900] : Colors.white
|
color: history.type == ChatHistoryType.income ? Colors.grey[900] : Colors.white
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-13 14:03:45
|
* @Date : 2022-10-13 14:03:45
|
||||||
* @LastEditTime : 2022-10-15 10:52:30
|
* @LastEditTime : 2022-10-22 21:30:26
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ class HistoryTile extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
UserAvatar(userid: history.message.senderID),
|
UserAvatar(userid: history.message.senderID, size: 42,),
|
||||||
const SizedBox(width: 16.0,),
|
const SizedBox(width: 16.0,),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: InMessageBox(history: history)
|
child: InMessageBox(history: history)
|
||||||
@ -58,7 +58,7 @@ class HistoryTile extends StatelessWidget {
|
|||||||
child: OutMessageBox(history: history),
|
child: OutMessageBox(history: history),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16.0,),
|
const SizedBox(width: 16.0,),
|
||||||
UserAvatar(userid: history.message.senderID),
|
UserAvatar(userid: history.message.senderID, size: 42,),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-14 13:49:47
|
* @Date : 2022-10-14 13:49:47
|
||||||
* @LastEditTime : 2022-10-20 13:56:20
|
* @LastEditTime : 2022-10-23 10:07:48
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -42,37 +42,37 @@ class InMessageBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
boxShadow: [BoxShadow(blurRadius: 5.0, color: Colors.grey.withOpacity(0.3))]
|
boxShadow: [BoxShadow(blurRadius: 5.0, color: Colors.grey.withOpacity(0.3))]
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: Column(
|
||||||
borderRadius: const BorderRadius.only(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
topLeft: Radius.circular(8.0),
|
mainAxisSize: MainAxisSize.min,
|
||||||
topRight: Radius.circular(8.0),
|
children: [
|
||||||
bottomLeft: Radius.zero,
|
if(history.message.type == MessageType.file)
|
||||||
bottomRight: Radius.circular(8.0)
|
FileBox(history: history),
|
||||||
),
|
if(history.message.type == MessageType.image)
|
||||||
child: Column(
|
ClipRRect(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
borderRadius: const BorderRadius.only(
|
||||||
mainAxisSize: MainAxisSize.min,
|
topLeft: Radius.circular(8.0),
|
||||||
children: [
|
topRight: Radius.circular(8.0),
|
||||||
if(history.message.type == MessageType.file)
|
bottomLeft: Radius.zero,
|
||||||
FileBox(history: history),
|
bottomRight: Radius.circular(8.0)
|
||||||
if(history.message.type == MessageType.image)
|
),
|
||||||
ImageBox(history: history),
|
child: ImageBox(history: history),
|
||||||
if(history.message.type == MessageType.plaintext)
|
),
|
||||||
TextBox(history: history),
|
if(history.message.type == MessageType.plaintext)
|
||||||
if(history.message.type != MessageType.image)
|
TextBox(history: history),
|
||||||
...[
|
if(history.message.type != MessageType.image)
|
||||||
const SizedBox(height: 4.0,),
|
...[
|
||||||
Text(
|
const SizedBox(height: 4.0,),
|
||||||
_getTimeStamp(history.message.timeStamp),
|
Text(
|
||||||
style: TextStyle(
|
_getTimeStamp(history.message.timeStamp),
|
||||||
fontSize: 12,
|
style: TextStyle(
|
||||||
color: Colors.grey[400],
|
fontSize: 12,
|
||||||
),
|
color: Colors.grey[400],
|
||||||
)
|
),
|
||||||
]
|
)
|
||||||
],
|
]
|
||||||
),
|
],
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
if(history.message.type == MessageType.image)
|
if(history.message.type == MessageType.image)
|
||||||
...[
|
...[
|
||||||
@ -96,9 +96,9 @@ class InMessageBox extends StatelessWidget {
|
|||||||
if(date.day == DateTime.now().day) {
|
if(date.day == DateTime.now().day) {
|
||||||
return '${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
return '${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
||||||
}
|
}
|
||||||
//If date is yesterday, return 'yesterday'
|
//If date is yda, return 'yda'
|
||||||
if(date.day == DateTime.now().day - 1) {
|
if(date.day == DateTime.now().day - 1) {
|
||||||
return 'yesterday ${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
return 'yda ${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
||||||
}
|
}
|
||||||
//If date is within this week, return the weekday in english
|
//If date is within this week, return the weekday in english
|
||||||
if(date.weekday < DateTime.now().weekday) {
|
if(date.weekday < DateTime.now().weekday) {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-14 17:54:30
|
* @Date : 2022-10-14 17:54:30
|
||||||
* @LastEditTime : 2022-10-20 11:18:48
|
* @LastEditTime : 2022-10-23 10:13:22
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,7 +34,12 @@ class InputBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
// height: 64,
|
// height: 64,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
|
padding: const EdgeInsets.only(
|
||||||
|
left: 16.0,
|
||||||
|
right: 4.0,
|
||||||
|
top: 16.0,
|
||||||
|
bottom: 16.0
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@ -79,7 +84,6 @@ class InputBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8.0,),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
var chatCubit = context.read<ChatCubit>();
|
var chatCubit = context.read<ChatCubit>();
|
||||||
@ -98,7 +102,6 @@ class InputBox extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
icon: Icon(Icons.attach_file_rounded, color: Colors.grey[700],)
|
icon: Icon(Icons.attach_file_rounded, color: Colors.grey[700],)
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8.0,),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
var chatCubit = context.read<ChatCubit>();
|
var chatCubit = context.read<ChatCubit>();
|
||||||
@ -116,7 +119,6 @@ class InputBox extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
icon: Icon(Icons.photo_rounded, color: Colors.grey[700],)
|
icon: Icon(Icons.photo_rounded, color: Colors.grey[700],)
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8.0,),
|
|
||||||
BlocBuilder<MessageInputCubit, MessageInputState>(
|
BlocBuilder<MessageInputCubit, MessageInputState>(
|
||||||
builder:(context, state) {
|
builder:(context, state) {
|
||||||
return IconButton(
|
return IconButton(
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-14 13:49:28
|
* @Date : 2022-10-14 13:49:28
|
||||||
* @LastEditTime : 2022-10-19 23:47:20
|
* @LastEditTime : 2022-10-23 10:07:32
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -42,37 +42,37 @@ class OutMessageBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
boxShadow: [BoxShadow(blurRadius: 5.0, color: Colors.grey.withOpacity(0.2))]
|
boxShadow: [BoxShadow(blurRadius: 5.0, color: Colors.grey.withOpacity(0.2))]
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: Column(
|
||||||
borderRadius: const BorderRadius.only(
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
topLeft: Radius.circular(8.0),
|
mainAxisSize: MainAxisSize.min,
|
||||||
topRight: Radius.circular(8.0),
|
children: [
|
||||||
bottomLeft: Radius.circular(8.0),
|
if(history.message.type == MessageType.file)
|
||||||
bottomRight: Radius.zero
|
FileBox(history: history),
|
||||||
),
|
if(history.message.type == MessageType.image)
|
||||||
child: Column(
|
ClipRRect(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
borderRadius: const BorderRadius.only(
|
||||||
mainAxisSize: MainAxisSize.min,
|
topLeft: Radius.circular(8.0),
|
||||||
children: [
|
topRight: Radius.circular(8.0),
|
||||||
if(history.message.type == MessageType.file)
|
bottomLeft: Radius.circular(8.0),
|
||||||
FileBox(history: history),
|
bottomRight: Radius.zero
|
||||||
if(history.message.type == MessageType.image)
|
),
|
||||||
ImageBox(history: history),
|
child: ImageBox(history: history),
|
||||||
if(history.message.type == MessageType.plaintext)
|
),
|
||||||
TextBox(history: history),
|
if(history.message.type == MessageType.plaintext)
|
||||||
if(history.message.type != MessageType.image)
|
TextBox(history: history),
|
||||||
...[
|
if(history.message.type != MessageType.image)
|
||||||
const SizedBox(height: 4.0,),
|
...[
|
||||||
Text(
|
const SizedBox(height: 4.0,),
|
||||||
_getTimeStamp(history.message.timeStamp),
|
Text(
|
||||||
style: TextStyle(
|
_getTimeStamp(history.message.timeStamp),
|
||||||
fontSize: 12,
|
style: TextStyle(
|
||||||
color: Colors.grey[200],
|
fontSize: 12,
|
||||||
),
|
color: Colors.grey[200],
|
||||||
)
|
),
|
||||||
],
|
)
|
||||||
],
|
],
|
||||||
),
|
],
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
if(history.message.type == MessageType.image)
|
if(history.message.type == MessageType.image)
|
||||||
...[
|
...[
|
||||||
@ -96,9 +96,9 @@ class OutMessageBox extends StatelessWidget {
|
|||||||
if(date.day == DateTime.now().day) {
|
if(date.day == DateTime.now().day) {
|
||||||
return '${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
return '${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
||||||
}
|
}
|
||||||
//If date is yesterday, return 'yesterday'
|
//If date is yda, return 'yda'
|
||||||
if(date.day == DateTime.now().day - 1) {
|
if(date.day == DateTime.now().day - 1) {
|
||||||
return 'yesterday ${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
return 'yda ${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
||||||
}
|
}
|
||||||
//If date is within this week, return the weekday in english
|
//If date is within this week, return the weekday in english
|
||||||
if(date.weekday < DateTime.now().weekday) {
|
if(date.weekday < DateTime.now().weekday) {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-13 13:17:52
|
* @Date : 2022-10-13 13:17:52
|
||||||
* @LastEditTime : 2022-10-20 00:52:14
|
* @LastEditTime : 2022-10-23 10:09:09
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -150,9 +150,9 @@ class MessageTile extends StatelessWidget {
|
|||||||
if(date.day == DateTime.now().day) {
|
if(date.day == DateTime.now().day) {
|
||||||
return '${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
return '${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
||||||
}
|
}
|
||||||
//If date is yesterday, return 'yesterday'
|
//If date is yda, return 'yda'
|
||||||
if(date.day == DateTime.now().day - 1) {
|
if(date.day == DateTime.now().day - 1) {
|
||||||
return 'yesterday';
|
return 'yda ${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
||||||
}
|
}
|
||||||
//If date is within this week, return the weekday in english
|
//If date is within this week, return the weekday in english
|
||||||
if(date.weekday < DateTime.now().weekday) {
|
if(date.weekday < DateTime.now().weekday) {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-12 15:06:30
|
* @Date : 2022-10-12 15:06:30
|
||||||
* @LastEditTime : 2022-10-20 20:55:07
|
* @LastEditTime : 2022-10-23 10:15:11
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ class LoginPage extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 6,
|
flex: 6,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width * 0.5,
|
width: MediaQuery.of(context).size.width * 0.7,
|
||||||
child: const LoginPanel()
|
child: const LoginPanel()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-12 16:29:25
|
* @Date : 2022-10-12 16:29:25
|
||||||
* @LastEditTime : 2022-10-20 20:43:51
|
* @LastEditTime : 2022-10-23 10:28:05
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -44,6 +44,11 @@ class UsernameInput extends StatelessWidget {
|
|||||||
onChanged: (username) {
|
onChanged: (username) {
|
||||||
context.read<LoginCubit>().onUsernameChange(Username.dirty(username));
|
context.read<LoginCubit>().onUsernameChange(Username.dirty(username));
|
||||||
},
|
},
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
textCapitalization: TextCapitalization.none,
|
||||||
|
autocorrect: false,
|
||||||
|
enableIMEPersonalizedLearning: false,
|
||||||
|
enableSuggestions: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Username',
|
labelText: 'Username',
|
||||||
errorText: state.username.invalid ? 'Invalid username' : null
|
errorText: state.username.invalid ? 'Invalid username' : null
|
||||||
@ -60,12 +65,21 @@ class PasswordInput extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<LoginCubit, LoginState>(
|
return BlocBuilder<LoginCubit, LoginState>(
|
||||||
buildWhen: (previous, current) => previous.password != current.password,
|
buildWhen: (previous, current) => previous.password != current.password || previous.status != current.status,
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return TextField(
|
return TextField(
|
||||||
onChanged: (password) {
|
onChanged: (password) {
|
||||||
context.read<LoginCubit>().onPasswordChange(Password.dirty(password));
|
context.read<LoginCubit>().onPasswordChange(Password.dirty(password));
|
||||||
},
|
},
|
||||||
|
onEditingComplete: () {
|
||||||
|
if(
|
||||||
|
state.status == FormzStatus.valid ||
|
||||||
|
state.status == FormzStatus.submissionFailure
|
||||||
|
) {
|
||||||
|
context.read<LoginCubit>().onSubmission();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Password',
|
labelText: 'Password',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-10 08:04:53
|
* @Date : 2022-10-10 08:04:53
|
||||||
* @LastEditTime : 2022-10-22 20:43:39
|
* @LastEditTime : 2022-10-23 10:32:16
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
@ -49,7 +49,7 @@ class SplashPage extends StatelessWidget {
|
|||||||
return BlocProvider<InitializationCubit>(
|
return BlocProvider<InitializationCubit>(
|
||||||
create: (context) {
|
create: (context) {
|
||||||
return InitializationCubit(
|
return InitializationCubit(
|
||||||
serverAddress: '192.168.43.155',
|
serverAddress: '127.0.0.1',
|
||||||
serverPort: 20706
|
serverPort: 20706
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-12 17:36:38
|
* @Date : 2022-10-12 17:36:38
|
||||||
* @LastEditTime : 2022-10-20 20:55:17
|
* @LastEditTime : 2022-10-23 10:15:31
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
@ -82,7 +82,7 @@ class RegisterPage extends StatelessWidget {
|
|||||||
listenWhen: (previous, current) => previous.status != current.status,
|
listenWhen: (previous, current) => previous.status != current.status,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width * 0.5,
|
width: MediaQuery.of(context).size.width * 0.7,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-12 16:29:25
|
* @Date : 2022-10-12 16:29:25
|
||||||
* @LastEditTime : 2022-10-20 20:54:22
|
* @LastEditTime : 2022-10-23 10:28:12
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -44,6 +44,11 @@ class UsernameInput extends StatelessWidget {
|
|||||||
onChanged: (username) {
|
onChanged: (username) {
|
||||||
context.read<RegisterCubit>().onUsernameChange(Username.dirty(username));
|
context.read<RegisterCubit>().onUsernameChange(Username.dirty(username));
|
||||||
},
|
},
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
textCapitalization: TextCapitalization.none,
|
||||||
|
autocorrect: false,
|
||||||
|
enableIMEPersonalizedLearning: false,
|
||||||
|
enableSuggestions: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Username',
|
labelText: 'Username',
|
||||||
errorText: state.username.invalid ? 'Invalid username' : null
|
errorText: state.username.invalid ? 'Invalid username' : null
|
||||||
@ -60,12 +65,21 @@ class PasswordInput extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<RegisterCubit, RegisterState>(
|
return BlocBuilder<RegisterCubit, RegisterState>(
|
||||||
buildWhen: (previous, current) => previous.password != current.password,
|
buildWhen: (previous, current) => previous.password != current.password || previous.status != current.status,
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return TextField(
|
return TextField(
|
||||||
onChanged: (password) {
|
onChanged: (password) {
|
||||||
context.read<RegisterCubit>().onPasswordChange(Password.dirty(password));
|
context.read<RegisterCubit>().onPasswordChange(Password.dirty(password));
|
||||||
},
|
},
|
||||||
|
onEditingComplete: () {
|
||||||
|
if(
|
||||||
|
state.status == FormzStatus.valid ||
|
||||||
|
state.status == FormzStatus.submissionFailure
|
||||||
|
) {
|
||||||
|
context.read<RegisterCubit>().onSubmission();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Password',
|
labelText: 'Password',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-13 17:04:12
|
* @Date : 2022-10-13 17:04:12
|
||||||
* @LastEditTime : 2022-10-14 10:38:44
|
* @LastEditTime : 2022-10-23 10:30:41
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ class SearchPage extends StatelessWidget {
|
|||||||
const SizedBox(height: 16.0,),
|
const SizedBox(height: 16.0,),
|
||||||
const Padding(
|
const Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 36.0,
|
horizontal: 24.0,
|
||||||
vertical: 8.0
|
vertical: 8.0
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -80,7 +80,7 @@ class SearchPage extends StatelessWidget {
|
|||||||
const SizedBox(height: 16.0,),
|
const SizedBox(height: 16.0,),
|
||||||
const Padding(
|
const Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 36.0,
|
horizontal: 24.0,
|
||||||
vertical: 8.0
|
vertical: 8.0
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -102,7 +102,7 @@ class SearchPage extends StatelessWidget {
|
|||||||
const SizedBox(height: 16.0,),
|
const SizedBox(height: 16.0,),
|
||||||
const Padding(
|
const Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 36.0,
|
horizontal: 24.0,
|
||||||
vertical: 8.0
|
vertical: 8.0
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-13 21:41:49
|
* @Date : 2022-10-13 21:41:49
|
||||||
* @LastEditTime : 2022-10-17 22:23:46
|
* @LastEditTime : 2022-10-23 10:30:06
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ class HistoryTile extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 16.0,
|
vertical: 8.0,
|
||||||
horizontal: 36.0
|
horizontal: 24.0
|
||||||
),
|
),
|
||||||
child: IntrinsicHeight(
|
child: IntrinsicHeight(
|
||||||
child: Row(
|
child: Row(
|
||||||
@ -87,9 +87,9 @@ class HistoryTile extends StatelessWidget {
|
|||||||
if(date.day == DateTime.now().day) {
|
if(date.day == DateTime.now().day) {
|
||||||
return '${date.hour}:${date.minute}';
|
return '${date.hour}:${date.minute}';
|
||||||
}
|
}
|
||||||
//If date is yesterday, return 'yesterday'
|
//If date is yda, return 'yda'
|
||||||
if(date.day == DateTime.now().day - 1) {
|
if(date.day == DateTime.now().day - 1) {
|
||||||
return 'yesterday';
|
return 'yda ${date.hour}:${date.minute.toString().padLeft(2, '0')}';
|
||||||
}
|
}
|
||||||
//If date is within this week, return the weekday in english
|
//If date is within this week, return the weekday in english
|
||||||
if(date.weekday < DateTime.now().weekday) {
|
if(date.weekday < DateTime.now().weekday) {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-13 21:41:41
|
* @Date : 2022-10-13 21:41:41
|
||||||
* @LastEditTime : 2022-10-18 11:28:17
|
* @LastEditTime : 2022-10-23 10:30:24
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,8 +35,8 @@ class UserTile extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 36,
|
horizontal: 24,
|
||||||
vertical: 16,
|
vertical: 8,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user