From df1db9f523f9c19d7ce14c176ba6ab02004e2c6e Mon Sep 17 00:00:00 2001 From: David Date: Fri, 21 Feb 2020 16:23:17 -0500 Subject: [PATCH] more info on feed cards --- lib/home_widget.dart | 79 ++------------------------------------------ lib/news_feed.dart | 74 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 77 deletions(-) create mode 100644 lib/news_feed.dart diff --git a/lib/home_widget.dart b/lib/home_widget.dart index 836765a..6dc6eaf 100644 --- a/lib/home_widget.dart +++ b/lib/home_widget.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'placeholder_widget.dart'; +import 'news_feed.dart'; class Home extends StatefulWidget { @override @@ -18,6 +18,7 @@ class HomeState extends State { HorizontalNewsFeed(title: Text("Basketball")), HorizontalNewsFeed(title: Text("Soccer")), HorizontalNewsFeed(title: Text("Football")), + HorizontalNewsFeed(title: Text("Volleyball")), ], ), bottomNavigationBar: BottomNavigationBar( @@ -41,79 +42,3 @@ class HomeState extends State { ); } } - -class HorizontalNewsFeed extends StatelessWidget { - const HorizontalNewsFeed({ - Key key, - @required this.title, - }) : super(key: key); - - final Widget title; - - @override - Widget build(BuildContext context) { - var width = MediaQuery.of(context).size.width / 2.25; - var height = width * .6; - - return Column( - children: [ - Divider(), - ListTile( - title: title, - trailing: IconButton( - icon: Icon(Icons.navigate_next), - onPressed: () { - showDialog( - context: context, - child: Center( - child: Card( - elevation: 10, - child: Image.network( - "https://discordemoji.com/assets/emoji/ThinkNoose.png", - width: 100, - height: 100, - ), - ), - ), - ); - }, - ), - ), - Container( - height: height, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: 6, - itemBuilder: (ictx, iidx) { - return NewsCard(height: height, width: width); - }, - ), - ), - ], - ); - } -} - -class NewsCard extends StatelessWidget { - const NewsCard({ - Key key, - @required this.height, - @required this.width, - }) : super(key: key); - - final double height; - final double width; - - @override - Widget build(BuildContext context) { - return Container( - height: height, - width: width, - child: Card( - child: ListTile( - title: Text("no u"), - ), - ), - ); - } -} diff --git a/lib/news_feed.dart b/lib/news_feed.dart new file mode 100644 index 0000000..41ab6eb --- /dev/null +++ b/lib/news_feed.dart @@ -0,0 +1,74 @@ +import 'package:flutter/material.dart'; + +class HorizontalNewsFeed extends StatelessWidget { + const HorizontalNewsFeed({ + Key key, + @required this.title, + }) : super(key: key); + + final Widget title; + + @override + Widget build(BuildContext context) { + var width = MediaQuery.of(context).size.width / 1.25; + var height = width * .6; + + return Column( + children: [ + Divider(), + ListTile( + title: title, + trailing: IconButton( + icon: Icon(Icons.navigate_next), + onPressed: () {}, + ), + ), + Container( + height: height, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: 6, + itemBuilder: (ictx, iidx) { + return NewsCard(height: height, width: width); + }, + ), + ), + ], + ); + } +} + +class NewsCard extends StatelessWidget { + const NewsCard({ + Key key, + @required this.height, + @required this.width, + }) : super(key: key); + + final double height; + final double width; + + @override + Widget build(BuildContext context) { + return SizedBox( + height: height, + width: width, + child: Card( + clipBehavior: Clip.antiAlias, + child: Wrap( + verticalDirection: VerticalDirection.up, + children: [ + ListTile( + title: Text("no u"), + trailing: Icon(Icons.more_horiz), + ), + Image.network( + "https://pbs.twimg.com/media/ERFFfZpU4AAJmIy.jpg:small", + fit: BoxFit.fitWidth, + ), + ], + ), + ), + ); + } +}