together_mobile/lib/screens/chat/chat_screen.dart

57 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'components/chat_tile.dart';
class ChatScreen extends StatefulWidget {
const ChatScreen({super.key});
@override
State<ChatScreen> createState() => _ChatScreenState();
}
class _ChatScreenState extends State<ChatScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: const CircleAvatar(
backgroundImage: AssetImage('assets/images/user.png'),
),
title: const Text("This is my name"),
centerTitle: true,
actions: [
IconButton(
onPressed: () {},
splashRadius: 20,
icon: const Icon(Icons.search),
),
IconButton(
onPressed: () {},
splashRadius: 20,
icon: const Icon(Icons.add),
),
],
),
body: SafeArea(
// Use ListView.builder because it renders list element on demand
child: RefreshIndicator(
onRefresh: () async {
return Future.delayed(const Duration(
seconds: 2,
));
},
child: ListView.builder(
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics(),
),
itemCount: 15,
itemBuilder: (BuildContext context, int index) {
return const ChatTile();
},
),
),
),
);
}
}