Skip to content

Instantly share code, notes, and snippets.

@BayBreezy
Created January 16, 2022 14:15
Show Gist options
  • Save BayBreezy/a86ce4943c0e3c23729470df666132a1 to your computer and use it in GitHub Desktop.
Save BayBreezy/a86ce4943c0e3c23729470df666132a1 to your computer and use it in GitHub Desktop.
Simple UI of a Chat List
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Chat List',
debugShowCheckedModeBanner: false,
theme: ThemeData(
textTheme: GoogleFonts.ibmPlexSansTextTheme(
ThemeData(brightness: Brightness.dark).textTheme,
),
brightness: Brightness.dark,
primarySwatch: Colors.deepPurple,
primaryColor: const Color(0xff581b98),
colorScheme: const ColorScheme.dark().copyWith(
secondary: Colors.orange,
)),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xff140029),
appBar: AppBar(
centerTitle: false,
toolbarHeight: 70,
actions: [
IconButton(
onPressed: () {},
icon: const Icon(Icons.search),
tooltip: "Search for chat",
),
const SizedBox(width: 10),
IconButton(
onPressed: () {},
icon: const Icon(Icons.more_vert),
tooltip: "Options",
),
],
title: const Text("Chatatot"),
backgroundColor: Colors.black26,
),
body: SafeArea(
child: ListView.builder(
physics: const BouncingScrollPhysics(),
itemCount: 15,
itemBuilder: (ctx, i) {
return Column(children: [
ListTile(
onTap: () {},
contentPadding:
const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
leading: const CircleAvatar(
radius: 30,
backgroundColor: Colors.purple,
child: CircleAvatar(
radius: 28,
backgroundImage: NetworkImage(
"https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=774&q=80"),
),
),
title: const Text("Sherice McGonelle"),
subtitle: const Text(
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker incl",
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
trailing: const Text(
"a min ago",
style: TextStyle(fontSize: 10),
)),
const Divider(
indent: 90,
),
]);
},
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {},
tooltip: 'New Message',
child: const Icon(
Icons.message,
color: Colors.white,
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment