Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:sanca_news/single_article.dart';
- void main() {
- runApp(MyApp());
- }
- class MyApp extends StatefulWidget {
- @override
- _MyAppState createState() => _MyAppState();
- }
- class _MyAppState extends State<MyApp> {
- String text =
- "Ini text beritanya Ini text beritanya Ini text beritanya Ini text ...";
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- home: Scaffold(
- // backgroundColor: Colors.green,
- appBar: AppBar(
- ...
- ...
- ),
- body: Padding(
- padding: const EdgeInsets.all(10.0),
- child: ListView(
- children: <Widget>[
- // card for newest articles
- Card(
- ...
- ...
- ),
- Container(
- margin: EdgeInsets.only(top: 20, bottom: 20),
- child: Row(
- children: [
- Flexible(
- flex: 1,
- child: Card(
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(10)),
- elevation: 5,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- ...
- ...
- ),
- Container(
- margin: EdgeInsets.only(
- bottom: 5, left: 10, right: 10),
- child: GestureDetector(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) =>
- SingleArticle()));
- },
- child: Text(
- "Ini text beritanya aja lagi ya",
- maxLines: 2,
- textAlign: TextAlign.center,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 14,
- fontStyle: FontStyle.italic,
- fontFamily: "Poppins",
- fontWeight: FontWeight.w700,
- ),
- ),
- ),
- )
- ],
- ),
- )),
- Flexible(
- flex: 1,
- child: Card(
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(10)),
- elevation: 5,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- margin: EdgeInsets.only(bottom: 5),
- height: 150,
- decoration: BoxDecoration(
- image: DecorationImage(
- image: AssetImage(
- "assets/images/content.png"),
- fit: BoxFit.cover),
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(10),
- topRight: Radius.circular(10))),
- ),
- Container(
- margin: EdgeInsets.only(
- bottom: 5, left: 10, right: 10),
- child: Text(
- "Ini Text Beritanya Aja Lagi Ya",
- textAlign: TextAlign.center,
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 14,
- fontStyle: FontStyle.italic,
- fontFamily: "Poppins",
- fontWeight: FontWeight.w700,
- ),
- ))
- ],
- ),
- )),
- ],
- ),
- ),
- BuildCard(text),
- BuildCard(text),
- BuildCard(text),
- BuildCard(text),
- BuildCard(text),
- ],
- ),
- )),
- );
- }
- }
- class BuildCard extends StatelessWidget {
- final String text;
- BuildCard(this.text);
- @override
- Widget build(BuildContext context) {
- return Card(
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
- elevation: 5,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Flexible(
- flex: 2,
- child: Container(
- margin: EdgeInsets.all(5),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- GestureDetector(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (BuildContext context) =>
- SingleArticle()));
- },
- child: Text(
- text,
- style: TextStyle(
- fontSize: 12,
- fontWeight: FontWeight.w700,
- fontFamily: "Poppins"),
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: 5),
- child: RaisedButton(
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (BuildContext context) =>
- SingleArticle()));
- },
- child: Text(
- "Read more ...",
- style: TextStyle(fontFamily: "Poppins"),
- ),
- ),
- )
- ],
- ))),
- Flexible(
- flex: 1,
- child: Container(
- margin: EdgeInsets.all(5),
- height: 100,
- width: 100,
- decoration: BoxDecoration(
- image: DecorationImage(
- image: AssetImage("assets/images/content.png"),
- fit: BoxFit.cover),
- borderRadius: BorderRadius.circular(12)),
- )),
- ],
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment