Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added padding , Text widget description #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/textwidget.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions lib/data/widget_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import 'package:flutter_folio/models/widget_model.dart';

List<WidgetModel> widgetData = [
WidgetModel(
name: "Text Widget",
description:
"The Text widget displays a string of text with single style. The string might break across multiple lines or might all be displayed on the same line depending on the layout constraints.The style argument is optional. When omitted, the text will use the style from the closest enclosing DefaultTextStyle. If the given style\'s TextStyle.inherit property is true (the default), the given style will be merged with the closest enclosing DefaultTextStyle. This merging behavior is useful, for example, to make the text bold while using the default font family and size.",
imagePath: "assets/textwidget.jpg"),
WidgetModel(
name: 'lorem ipsum',
description: 'Description for the widget goes here.',
Expand Down
32 changes: 19 additions & 13 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
// home_screen.dart
import 'package:flutter/material.dart';
import '/models/widget_model.dart';
// import '/models/widget_model.dart';
import '/data/widget_data.dart';

class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('FlutterFolio Widget Catalog'),
title: const Text('FlutterFolio Widget Catalog'),
),
body: ListView.builder(
itemCount: widgetData.length,
itemBuilder: (context, index) {
final widget = widgetData[index];
return ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, '/widgetDetail', arguments: widget);
},
child: Text(widget.name),
);
},
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView.builder(
itemCount: widgetData.length,
itemBuilder: (context, index) {
final widget = widgetData[index];
return ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, '/widgetDetail',
arguments: widget);
},
child: Text(widget.name),
);
},
),
),
);
}
Expand Down
11 changes: 6 additions & 5 deletions lib/screens/widget_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ class WidgetDetailScreen extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
Image.asset(
widget.imagePath,
width: 200,
),
const Text(
'Description:',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
Text(
widget.description,
style: TextStyle(fontSize: 16),
),
Image.asset(
widget.imagePath,
width: 200,
),

// Add code snippet or additional details here
],
),
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ flutter:
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
assets:
- assets/textwidget.jpg
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
Expand Down