swifty_chat 1.6.5 swifty_chat: ^1.6.5 copied to clipboard
A Flutter package to quickly get started building Chat UIs with different type of message kinds.
import 'package:example/advanced_chat.dart';
import 'package:example/basic_chat.dart';
import 'package:example/custom_message_kind_chat.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
// ignore: library_private_types_in_public_api
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Chat',
debugShowCheckedModeBanner: false,
routes: {
'/': (_) => const Home(),
'/basic-chat': (_) => const BasicChat(key: Key('basic_chat')),
'/advanced-chat': (_) => const AdvancedChat(key: Key('advanced_chat')),
'/custom-message-kind-chat': (_) =>
const CustomMessageKindChat(key: Key('custom_message_kind_chat')),
},
);
}
}
final class Home extends StatelessWidget {
const Home({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
children: [
const Divider(color: Colors.white70),
ListTile(
key: const Key('basic_chat_item'),
title: const Text('Basic Chat'),
trailing: const Icon(Icons.keyboard_arrow_right_rounded),
onTap: () => Navigator.of(context).pushNamed('/basic-chat'),
),
const Divider(color: Colors.white70),
ListTile(
key: const Key('advanced_chat_item'),
title: const Text('Advanced Chat'),
trailing: const Icon(Icons.keyboard_arrow_right_rounded),
onTap: () => Navigator.of(context).pushNamed('/advanced-chat'),
),
const Divider(color: Colors.white70),
ListTile(
key: const Key('custom_message_chat_item'),
title: const Text('Custom Message Chat'),
trailing: const Icon(Icons.keyboard_arrow_right_rounded),
onTap: () =>
Navigator.of(context).pushNamed('/custom-message-kind-chat'),
),
],
),
);
}
}