Skip to content

Instantly share code, notes, and snippets.

@enzobonggio
Created October 23, 2021 15:56
Show Gist options
  • Save enzobonggio/dbf12cbd84a7b57d06671d44e3e63006 to your computer and use it in GitHub Desktop.
Save enzobonggio/dbf12cbd84a7b57d06671d44e3e63006 to your computer and use it in GitHub Desktop.
class CustomWidget extends StatelessWidget {
final String image;
final String nombre;
const CustomWidget({required this.image, required this.nombre});
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Image.asset(
image,
width: 100,
),
Text(
nombre,
style: const TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w700, // w700 = bold - mejor usar bold para recordar al leerlo
),
textDirection: TextDirection.ltr, // Esto no es necesario, solo si pensas es que esto va a ser usado en lugares donde se escriba al revez
),
],
),
);
}
}
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.white,
shadowColor: Colors.white,
elevation: 0,
centerTitle: true,
title: Text(
"Home",
style: TextStyle(
color: Colors.black,
),
textAlign: TextAlign.center,
),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
decoration: const InputDecoration(
prefixIcon: Icon(Icons.find_in_page, color: Colors.black),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(15))),
hintText: 'Title, authors, or topics'),
onChanged: (value) {},
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Row(
children: [
Text(
"Categories",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 26,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Container(
color: Colors.blue,
height: 10,
width: 10,
)
],
),
Container(
height: 200,
color: Colors.red,
),
],
)),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Trending Books",
style: const TextStyle(
color: Colors.black,
fontSize: 26,
fontWeight: FontWeight.bold,
),
textDirection: TextDirection.ltr,
),
Text(
"See All",
style: TextStyle(
fontSize: 15,
color: Colors.grey,
),
),
],
),
),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Row(
children: [
CustomWidget(image: "assets/images/libro1.jpg", nombre: "El nombre 1"),
Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
Image.asset(
"assets/images/libro2.jpg",
width: 100,
),
Text(
"El nombre ",
style: const TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w700,
),
textDirection: TextDirection.ltr,
),
],
),
),
Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
Image.asset(
"assets/images/libro3.jpg",
width: 100,
),
Text(
"El nombre 2",
style: const TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w700,
),
textDirection: TextDirection.ltr,
),
],
),
),
],
),
]),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Row(
children: [
Text(
"Top Authors",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 26,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Container(
color: Colors.blue,
height: 10,
width: 10,
)
],
),
Container(
height: 120,
color: Colors.red,
),
],
)),
]),
)),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment