Created
September 8, 2021 15:40
-
-
Save yeasin50/e079c0e90179393ad27de7c0be132489 to your computer and use it in GitHub Desktop.
ListTile/Card with Row<Column>
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(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
final defaultBorderRadiusCircular = 12.0; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.deepPurple, | |
body: ListView.builder( | |
itemCount: 12, | |
itemBuilder: (context, index) => Card( | |
elevation: 8, | |
child: Container( | |
width: double.infinity, | |
decoration: BoxDecoration( | |
color: Colors.white, | |
borderRadius: BorderRadius.circular(defaultBorderRadiusCircular), | |
), | |
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 6), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: [ | |
Row( | |
children: [ | |
SizedBox( | |
width: 70.0, | |
height: 70.0, | |
child: ClipRRect( | |
borderRadius: | |
BorderRadius.circular(defaultBorderRadiusCircular), | |
child: Image.asset( | |
'imagePath', | |
width: 70, | |
height: 70, | |
fit: BoxFit.cover, | |
), | |
), | |
), | |
const SizedBox( | |
width: 24, | |
), | |
Column( | |
children: [ | |
const Text( | |
'Danau Beretan', | |
), | |
const Text( | |
'Indonesia', | |
), | |
], | |
), | |
], | |
), | |
Row( | |
children: [ | |
Icon(Icons.star_half_outlined), | |
Text("4.5"), | |
], | |
) | |
], | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment