Skip to content

Instantly share code, notes, and snippets.

@henryla92
Created February 21, 2019 23:02
Show Gist options
  • Save henryla92/024d2f3a6f416ce2fc371d1309a0f0ad to your computer and use it in GitHub Desktop.
Save henryla92/024d2f3a6f416ce2fc371d1309a0f0ad to your computer and use it in GitHub Desktop.
homepage
import 'package:flutter/material.dart';
import 'package:new_platform/screens/home.dart';
import 'package:parallax_image/parallax_image.dart';
class ArticlePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
Widget header = GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 35.0, horizontal: 10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.0),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey[300],
blurRadius: 5.0,
spreadRadius: 2.0,
offset: Offset(0, 5)),
]),
child: Hero(
tag: 'hero',
child: ClipRRect(
borderRadius: BorderRadius.vertical(top: Radius.circular(5.0)),
child: ParallaxImage(
image: AssetImage('lib/images/tile.jpg'),
extent: 300,
),
),
)),
);
Widget home = Container(
color: Color(0xffFCFFFC),
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: ListView(
children: <Widget>[
header,
],
),
));
return Scaffold(
resizeToAvoidBottomPadding: false,
body: home,
);
}
}
import 'package:flutter/material.dart';
import 'package:parallax_image/parallax_image.dart';
import 'package:new_platform/screens/article_page.dart';
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
double w85 = width * 0.85;
Widget tile = GestureDetector(
onTap: (){
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ArticlePage()),
);
},
child: Container(
margin: EdgeInsets.all(20.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey[100],
blurRadius: 5.0,
spreadRadius: 2.0,
offset: Offset(0, 3)),
]),
child: Column(
children: <Widget>[
Container(
height: 350.0,
child: Hero(
tag: 'hero',
child: ClipRRect(
borderRadius: BorderRadius.vertical(top: Radius.circular(5.0)),
child: ParallaxImage(
image: AssetImage('lib/images/tile.jpg'),
extent: w85,
),
),
),
),
Container(
margin: EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
Text(
"Title of Block",
style: TextStyle(
fontSize: 15.0,
),
),
Text(
"Description of text...description...",
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[500],
height: 1.2,
fontFamily: "Roboto",
),
),
],
))
],
),
),
);
Widget tile2 = Container(
margin: EdgeInsets.all(20.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.0),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey[100],
blurRadius: 5.0,
spreadRadius: 2.0,
offset: Offset(0, 3)),
]),
child: Column(
children: <Widget>[
Container(
height: 350.0,
child: ClipRRect(
borderRadius: BorderRadius.vertical(top: Radius.circular(30.0)),
child: ParallaxImage(
image: AssetImage('lib/images/tile2.jpg'),
extent: w85,
),
),
),
Container(
margin: EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
Text(
"Title of Block",
style: TextStyle(
fontSize: 15.0,
),
),
Text(
"Description of text...description...",
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[500],
height: 1.2,
fontFamily: "Roboto",
),
),
],
))
],
),
);
Widget tile3 = Container(
margin: EdgeInsets.all(20.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.0),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey[100],
blurRadius: 5.0,
spreadRadius: 2.0,
offset: Offset(0, 3)),
]),
child: Column(
children: <Widget>[
Container(
height: 350.0,
child: ClipRRect(
borderRadius: BorderRadius.vertical(top: Radius.circular(50.0)),
child: ParallaxImage(
image: AssetImage('lib/images/tile3.jpg'),
extent: w85,
),
),
),
Container(
margin: EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
Text(
"Title of Block",
style: TextStyle(
fontSize: 15.0,
),
),
Text(
"Description of text...description...",
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[500],
height: 1.2,
fontFamily: "Roboto",
),
),
],
))
],
),
);
Widget tile4 = Container(
margin: EdgeInsets.all(20.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.0),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey[100],
blurRadius: 5.0,
spreadRadius: 2.0,
offset: Offset(0, 3)),
]),
child: Column(
children: <Widget>[
Container(
height: 350.0,
child: ClipRRect(
borderRadius: BorderRadius.vertical(top: Radius.circular(30.0)),
child: ParallaxImage(
image: AssetImage('lib/images/tile4.jpg'),
extent: w85,
),
),
),
Container(
margin: EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
Text(
"Title of Block",
style: TextStyle(
fontSize: 15.0,
),
),
Text(
"Description of text...description...",
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[500],
height: 1.2,
fontFamily: "Roboto",
),
),
],
))
],
),
);
Widget horizontalList1 = Container(
margin: EdgeInsets.symmetric(vertical: 20.0),
height: 450.0,
child: PageView(
scrollDirection: Axis.horizontal,
controller: PageController(viewportFraction: 0.80, initialPage: 0),
children: <Widget>[tile, tile2, tile3, tile4],
));
Widget home = Container(
color: Color(0xffFCFFFC),
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: ListView(
children: <Widget>[
horizontalList1,
],
),
));
return Scaffold(
resizeToAvoidBottomPadding: false,
body: home,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment