drifter_app/lib/pages/message_screen/widgets/message_input.dart

97 lines
2.5 KiB
Dart
Raw Normal View History

import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/material.dart';
class MessageInput extends StatefulWidget {
const MessageInput({
super.key,
});
@override
State<MessageInput> createState() => _MessageInputState();
}
class _MessageInputState extends State<MessageInput> {
late final TextEditingController messageController;
late final FocusNode messageFocusNode;
void submitData() {
final newMessage = messageController;
}
@override
void initState() {
messageController = TextEditingController();
messageFocusNode = FocusNode();
super.initState();
}
@override
void dispose() {
messageController.dispose();
messageFocusNode.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment.bottomCenter,
child: Container(
padding: const EdgeInsets.only(bottom: 16, left: 8, right: 8, top: 8),
child: Row(
children: [
GestureDetector(
onTap: () {},
child: Container(
child: Icon(
Icons.add_a_photo,
color: AppColors.mainAccent,
size: 40,
),
),
),
const SizedBox(
width: 8,
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: ClipRRect(
borderRadius: const BorderRadius.all(
Radius.circular(
0.0,
),
),
child: TextField(
controller: messageController,
focusNode: messageFocusNode,
style: const TextStyle(
fontSize: 14,
),
decoration: InputDecoration(
hintText: 'What\'s new?',
hintStyle: const TextStyle(fontSize: 14),
suffixIcon: IconButton(
icon: const Icon(
Icons.send,
color: AppColors.mainDarkBlue,
size: 30,
),
onPressed: () {
submitData();
},
),
),
),
),
),
),
],
),
),
);
}
}