Skip to content

Commit

Permalink
feat: add composer focus and ripple to empty view
Browse files Browse the repository at this point in the history
This Closes #273
  • Loading branch information
Julian KOUNE committed Jul 13, 2023
1 parent a90350e commit 1207aa6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 37 deletions.
4 changes: 3 additions & 1 deletion lib/pages/chat/chat_event_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ class ChatEventList extends StatelessWidget {
controller: controller.scrollController,
physics: const ClampingScrollPhysics(),
child: controller.room?.isDirectChat ?? true
? const DirectChatEmptyView()
? DirectChatEmptyView(
onTap: () => controller.inputFocus.requestFocus(),
)
: const GroupChatEmptyView(),
),
),
Expand Down
78 changes: 42 additions & 36 deletions lib/pages/chat/direct_chat_empty_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,56 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';

class DirectChatEmptyView extends StatelessWidget {

final void Function()? onTap;

const DirectChatEmptyView({
Key? key,
this.onTap,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(16),
constraints: const BoxConstraints(
maxWidth: 236,
),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.04),
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
L10n.of(context)!.noMessageHereYet,
style: const TextStyle(
fontWeight: FontWeight.w700,
fontSize: 17,
color: Colors.black,
return InkWell(
borderRadius: BorderRadius.circular(16),
onTap: onTap,
child: Container(
padding: const EdgeInsets.all(16),
constraints: const BoxConstraints(
maxWidth: 236,
),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.04),
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
L10n.of(context)!.noMessageHereYet,
style: const TextStyle(
fontWeight: FontWeight.w700,
fontSize: 17,
color: Colors.black,
),
),
const SizedBox(height: 8),
Text(
L10n.of(context)!.sendMessageGuide,
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.w400,
fontSize: 15,
color: Color(0xFF818C99),
),
),
),
const SizedBox(height: 8),
Text(
L10n.of(context)!.sendMessageGuide,
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.w400,
fontSize: 15,
color: Color(0xFF818C99),
const SizedBox(height: 8),
Text(
'🤗',
style: Theme.of(context).textTheme.titleLarge?.merge(const TextStyle(fontSize: 88)),
),
),
const SizedBox(height: 8),
Text(
'🤗',
style: Theme.of(context).textTheme.titleLarge?.merge(const TextStyle(fontSize: 88)),
),
],
],
),
),
);
}
Expand Down

0 comments on commit 1207aa6

Please sign in to comment.