Created
January 8, 2025 09:44
-
-
Save Lxxyx/4a058a4bb6978de489db0df71d839071 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: 'Flutter Demo Home Page'), | |
); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
final String title; | |
const MyHomePage({ | |
super.key, | |
required this.title, | |
}); | |
@override | |
State<MyHomePage> createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), | |
), | |
body: Padding( | |
padding: const EdgeInsets.all(16.0), | |
child: GridView.count( | |
crossAxisCount: 2, | |
childAspectRatio: 2.5, | |
crossAxisSpacing: 10, | |
mainAxisSpacing: 10, | |
children: [ | |
Card( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: [ | |
Text('John Doe'), | |
Text('Hello, I am John Doe'), | |
ElevatedButton(onPressed: () {}, child: Text('Chat')), | |
], | |
), | |
), | |
Card( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: [ | |
Text('Jane Doe'), | |
Text('Hello, I am Jane Doe'), | |
ElevatedButton(onPressed: () {}, child: Text('Chat')), | |
], | |
), | |
), | |
Card( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: [ | |
Text('Bob Smith'), | |
Text('Hello, I am Bob Smith'), | |
ElevatedButton(onPressed: () {}, child: Text('Chat')), | |
], | |
), | |
), | |
Card( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: [ | |
Text('Alice Johnson'), | |
Text('Hello, I am Alice Johnson'), | |
ElevatedButton(onPressed: () {}, child: Text('Chat')), | |
], | |
), | |
), | |
// Add more cards here | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment