chat_composer 1.0.3 copy "chat_composer: ^1.0.3" to clipboard
chat_composer: ^1.0.3 copied to clipboard

A Flutter package for easy implementation of chat composer allows users to chat with Text, Audio, and Other Media.

example/lib/main.dart

import 'package:chat_composer/chat_composer.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<String> list = [];
  TextEditingController con = TextEditingController();
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          centerTitle: true,
          title: const Text('Chat Composer'),
        ),
        body: Column(
          children: [
            Expanded(
              child: ListView.builder(
                  itemCount: list.length,
                  itemBuilder: (_, pos) {
                    return ListTile(title: Text(list[pos]));
                  }),
            ),
            ChatComposer(
              controller: con,
              onReceiveText: (str) {
                setState(() {
                  list.add('TEXT : ${str!}');
                  con.text = '';
                });
              },
              onRecordEnd: (path) {
                setState(() {
                  list.add('AUDIO PATH : ${path!}');
                });
              },
              textPadding: EdgeInsets.zero,
              leading: CupertinoButton(
                padding: EdgeInsets.zero,
                child: const Icon(
                  Icons.insert_emoticon_outlined,
                  size: 25,
                  color: Colors.grey,
                ),
                onPressed: () {},
              ),
              actions: [
                CupertinoButton(
                  padding: EdgeInsets.zero,
                  child: const Icon(
                    Icons.attach_file_rounded,
                    size: 25,
                    color: Colors.grey,
                  ),
                  onPressed: () {},
                ),
                CupertinoButton(
                  padding: EdgeInsets.zero,
                  child: const Icon(
                    Icons.camera_alt_rounded,
                    size: 25,
                    color: Colors.grey,
                  ),
                  onPressed: () {},
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
46
likes
130
points
108
downloads

Publisher

verified publisheranouarkabbouri.com

Weekly Downloads

A Flutter package for easy implementation of chat composer allows users to chat with Text, Audio, and Other Media.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

bloc, flutter, flutter_bloc, flutter_sound_lite, fluttertoast, path_provider, permission_handler, plugin_platform_interface

More

Packages that depend on chat_composer