Skip to content

Instantly share code, notes, and snippets.

@cerberodev
Last active February 28, 2023 03:30
Show Gist options
  • Save cerberodev/3de252120f29797f9381b0845f8257c7 to your computer and use it in GitHub Desktop.
Save cerberodev/3de252120f29797f9381b0845f8257c7 to your computer and use it in GitHub Desktop.
Gist of class M1S3 of the UCamp Flutter BootCamp
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',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Clase Tres'),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: Center(
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const CircleAvatar(
radius: 50,
backgroundImage: NetworkImage(
'https://www.w3schools.com/howto/img_forest.jpg'),
),
const SizedBox(height: 10),
Container(
color: Colors.teal,
child: const Text('Strawberry Pavlova'),
),
const SizedBox(height: 10),
Container(
width: 250,
color: Colors.teal,
child: const Text(
'Pavlova is a meringye based dessert named after the Russian ballerina Anna Pavlova. Pavlova features a crisp crust and soft, light inside, topped with fruit and whipped cream.',
maxLines: 5,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
),
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.all(2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: Row(
mainAxisSize: MainAxisSize.min,
children: const [
Icon(Icons.star, size: 16),
Icon(Icons.star, size: 16),
Icon(Icons.star, size: 16),
Icon(Icons.star, size: 16),
Icon(Icons.star, size: 16),
],
),
),
const SizedBox(width: 2),
SizedBox(
width: MediaQuery.of(context).size.width * 0.1,
child: const Text(
'170 Reviews',
overflow: TextOverflow.ellipsis,
),
)
],
),
),
const SizedBox(height: 10),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Column(
mainAxisSize: MainAxisSize.min,
children: const [
Icon(Icons.kitchen),
SizedBox(height: 5),
Text('PREP:'),
SizedBox(height: 5),
Text('25 min'),
],
),
const SizedBox(width: 10),
Column(
mainAxisSize: MainAxisSize.min,
children: const [
Icon(Icons.timer),
SizedBox(height: 5),
Text('COOK:'),
SizedBox(height: 5),
Text('1 hr'),
],
),
const SizedBox(width: 10),
Column(
mainAxisSize: MainAxisSize.min,
children: const [
Icon(Icons.restaurant),
SizedBox(height: 5),
Text('FEEDS:'),
SizedBox(height: 5),
Text('4-6'),
],
),
],
),
],
),
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.4,
height: MediaQuery.of(context).size.width * 1,
child: Image.network(
'https://www.w3schools.com/howto/img_forest.jpg',
fit: BoxFit.cover,
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment