Skip to content

Commit

Permalink
Travelsory (lohanidamodar#75)
Browse files Browse the repository at this point in the history
* changes upto

* DiscoveryPage

* travel story page

* travel story page

Co-authored-by: Aparna16 <aparna@kumarijob.com>
Co-authored-by: Damodar Lohani <lohanidamodar@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 10, 2021
1 parent 1a65113 commit ea494a7
Show file tree
Hide file tree
Showing 4 changed files with 322 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ The code for Springy Widget is taken and refactored from (https://github.com/mat

## Travel App

<img height="480px" src="screenshots/travel_home1.png"> <img height="480px" src="screenshots/thome.png"> <img height="480px" src="screenshots/tdetails.png"> <img height="480px" src="screenshots/travel_nepal.gif">
<img height="480px" src="screenshots/travelstory.jpg"> <img height="480px" src="screenshots/travel_home1.png"> <img height="480px" src="screenshots/thome.png"> <img height="480px" src="screenshots/tdetails.png"> <img height="480px" src="screenshots/travel_nepal.gif">

## grocery App UI Kit

Expand Down
2 changes: 2 additions & 0 deletions lib/core/presentation/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import 'package:flutter_ui_challenges/src/pages/settings/settings2.dart';
import 'package:flutter_ui_challenges/src/pages/settings/settings3.dart';
import 'package:flutter_ui_challenges/src/pages/settings/settings4.dart';
import 'package:flutter_ui_challenges/src/pages/todo/todo_home3.dart';
import 'package:flutter_ui_challenges/src/pages/travel/travelstory.dart';
import 'package:flutter_ui_challenges/src/walletapp_ui/main.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:flutter_ui_challenges/src/pages/todo/todo2.dart';
Expand Down Expand Up @@ -315,6 +316,7 @@ final List<dynamic> pages = [
SubMenuItem("Travel Destination Detail", DestinationPage(),
path: DestinationPage.path),
SubMenuItem("Travel Home2", TravelHome(), path: TravelHome.path),
SubMenuItem("Travel Stroy", TravelStoryPage(), path: TravelStoryPage.path),
]),
MenuItem(title: "Hotel", icon: Icons.hotel, items: [
SubMenuItem("Hotel Booking Homepage", HotelBookingPage(),
Expand Down
319 changes: 319 additions & 0 deletions lib/src/pages/travel/travelstory.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,319 @@
/**
* Author: Ambika Dulal
* profile: https://github.com/Ambikadulal
* design concept:uikit
* image:pixabay
*/

import 'package:flutter/material.dart';
import 'dart:math';
List<String> images = [
'https://cdn.pixabay.com/photo/2017/03/10/00/19/nepal-2131320__340.jpg',
'https://cdn.pixabay.com/photo/2020/06/27/10/32/travel-5345468__340.jpg',
'https://cdn.pixabay.com/photo/2020/07/10/16/25/nepal-5391217__340.jpg',
'https://cdn.pixabay.com/photo/2016/05/12/20/28/nepal-1388600__340.jpg',
];
List<String> title = [
"We love Nepal",
"Fallen In Love",
"The dreaming moon",
"Bhaktapur and patan darbar Temple",
];
class TravelStoryPage extends StatefulWidget {
static final String path = "lib/src/pages/travel/tstory.dart";
@override
_TravelStoryPageState createState() => new _TravelStoryPageState();
}
var cardAspectRatio = 12.0 / 16.0;
var widgetAspectRatio = cardAspectRatio * 1.2;

class _TravelStoryPageState extends State<TravelStoryPage> {
var currentPage = images.length - 1.0;

@override
Widget build(BuildContext context) {
PageController controller = PageController(initialPage: images.length - 1);
controller.addListener(() {
setState(() {
currentPage = controller.page;
});
});
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0xFF1b1e44),
Color(0xFF2d3447),
],
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
tileMode: TileMode.clamp)),
child: Scaffold(
backgroundColor: Colors.transparent,
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
left: 12.0, right: 12.0, top: 30.0, bottom: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: Icon(
Icons.menu,
color: Colors.white,
size: 30.0,
),
onPressed: () {},
),
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
size: 30.0,
),
onPressed: () {},
)
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text("Trending",
style: TextStyle(
color: Colors.white,
fontSize: 46.0,
fontFamily: "Calibre-Semibold",
letterSpacing: 1.0,
)),
IconButton(
icon: Icon(
Icons.more_horiz,
size: 20.0,
color: Colors.white,
),
onPressed: () {},
)
],
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: Row(
children: <Widget>[
Container(
decoration: BoxDecoration(
color: Color(0xFFff6e6e),
borderRadius: BorderRadius.circular(20.0),
),
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 22.0, vertical: 6.0),
child: Text("Animated",
style: TextStyle(color: Colors.white)),
),
),
),
SizedBox(
width: 15.0,
),
Text("25+ Stories",
style: TextStyle(color: Colors.blueAccent))
],
),
),
Stack(
children: <Widget>[
CardScrollWidget(currentPage),
Positioned.fill(
child: PageView.builder(
itemCount: images.length,
controller: controller,
reverse: true,
itemBuilder: (context, index) {
return Container();
},
),
)
],
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text("Favourite",
style: TextStyle(
color: Colors.white,
fontSize: 46.0,
letterSpacing: 1.0,
)),
IconButton(
icon: Icon(
Icons.favorite,
size: 16.0,
color: Colors.white,
),
onPressed: () {},
)
],
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: Row(
children: <Widget>[
Container(
decoration: BoxDecoration(
color: Colors.blueAccent,
borderRadius: BorderRadius.circular(20.0),
),
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 22.0, vertical: 6.0),
child: Text("Latest",
style: TextStyle(color: Colors.white)),
),
),
),
SizedBox(
width: 15.0,
),
Text("9+ Stories",
style: TextStyle(color: Colors.blueAccent))
],
),
),
SizedBox(
height: 20.0,
),
Row(
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 18.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network("https://cdn.pixabay.com/photo/2020/04/14/19/41/nepal-5044097__340.jpg",
width: 296.0, height: 222.0),
),
)
],
)
],
),
),
),
);
}
}

class CardScrollWidget extends StatelessWidget {
final currentPage;
final padding = 20.0;
final verticalInset = 20.0;

CardScrollWidget(this.currentPage);
@override
Widget build(BuildContext context) {
return new AspectRatio(
aspectRatio: widgetAspectRatio,
child: LayoutBuilder(builder: (context, contraints) {
var width = contraints.maxWidth;
var height = contraints.maxHeight;

var safeWidth = width - 2 * padding;
var safeHeight = height - 2 * padding;

var heightOfPrimaryCard = safeHeight;
var widthOfPrimaryCard = heightOfPrimaryCard * cardAspectRatio;

var primaryCardLeft = safeWidth - widthOfPrimaryCard;
var horizontalInset = primaryCardLeft / 2;

List<Widget> cardList = new List();

for (var i = 0; i < images.length; i++) {
var delta = i - currentPage;
bool isOnRight = delta > 0;

var start = padding +
max(
primaryCardLeft -
horizontalInset * -delta * (isOnRight ? 15 : 1),
0.0);

var cardItem = Positioned.directional(
top: padding + verticalInset * max(-delta, 0.0),
bottom: padding + verticalInset * max(-delta, 0.0),
start: start,
textDirection: TextDirection.rtl,
child: ClipRRect(
borderRadius: BorderRadius.circular(16.0),
child: Container(
decoration: BoxDecoration(color: Colors.white, boxShadow: [
BoxShadow(
color: Colors.black12,
offset: Offset(3.0, 6.0),
blurRadius: 10.0)
]),
child: AspectRatio(
aspectRatio: cardAspectRatio,
child: Stack(
fit: StackFit.expand,
children: <Widget>[
Image.network(images[i], fit: BoxFit.cover),
Align(
alignment: Alignment.bottomLeft,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.0, vertical: 8.0),
child: Text(title[i],
style: TextStyle(
color: Colors.white,
fontSize: 25.0,
)),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(
left: 12.0, bottom: 12.0),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 22.0, vertical: 6.0),
decoration: BoxDecoration(
color: Colors.blueAccent,
borderRadius: BorderRadius.circular(20.0)),
child: Text("Read Later",
style: TextStyle(color: Colors.white)),
),
)
],
),
)
],
),
),
),
),
);
cardList.add(cardItem);
}
return Stack(
children: cardList,
);
}),
);
}
}
Binary file added screenshots/travelstory.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ea494a7

Please sign in to comment.