aboutsummaryrefslogtreecommitdiff
path: root/lib/widgets/chat_bottom_sheet.dart
blob: f1124cf7978a84c80c532f72a0608797bfec527f (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
45
46
47
48
49
50
51
52
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 Container(
      height: 55,
      decoration: BoxDecoration(boxShadow: [
        BoxShadow(
          color: Colors.grey.withOpacity(0.5),
          spreadRadius: 2,
          blurRadius: 10,
          offset: const Offset(0, 3),
        ),
      ]),
      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();
              },
            ),
          ),
        ],
      ),
    );
  }
}