Created
January 22, 2025 13:01
-
-
Save Lxxyx/c07935dc08bc0ea90eb428e94b8c1f79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData( | |
colorSchemeSeed: Colors.blue, | |
), | |
home: const MyHomePage(title: 'Chat List'), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
final String title; | |
const MyHomePage({ | |
super.key, | |
required this.title, | |
}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(title), | |
), | |
body: ListView.builder( | |
itemCount: 10, | |
itemBuilder: (context, index) { | |
return ListTile( | |
leading: const CircleAvatar( | |
backgroundImage: NetworkImage('https://via.placeholder.com/50'), | |
), | |
title: Text('Name $index'), | |
subtitle: Text('This is a message from Name $index'), | |
trailing: ElevatedButton( | |
onPressed: () {}, | |
child: const Text('Link'), | |
), | |
); | |
}, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment