aboutsummaryrefslogtreecommitdiff
path: root/lib/widgets/chat_bottom_sheet.dart
blob: ac084993da8b533ade75b310e9868ef45a77ff2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import 'package:flutter/material.dart';

class ChatBottomSheet extends StatelessWidget {
  final Function(String msg) onPressed;
  final TextEditingController _controller = TextEditingController();

  ChatBottomSheet({super.key, required this.onPressed});

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 55,
      child: Row(
        children: [
          Padding(
            padding: const EdgeInsets.only(left: 10),
            child: Container(
              alignment: Alignment.centerRight,
              width: 270,
              child: TextFormField(
                controller: _controller,
                decoration: const InputDecoration(
                  hintText: "Escribe algo",
                  border: InputBorder.none,
                ),
              ),
            ),
          ),
          const Spacer(),
          Padding(
            padding: const EdgeInsets.only(right: 10),
            child: IconButton(
              icon: const Icon(Icons.send),
              onPressed: () {
                onPressed(_controller.value.text);
                _controller.clear();
              },
            ),
          ),
        ],
      ),
    );
  }
}