Skip to content

Commit

Permalink
fonts; spaced_model_wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemix committed Jun 21, 2018
1 parent e66b5c4 commit 3e8b73e
Show file tree
Hide file tree
Showing 23 changed files with 342 additions and 214 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/screenshots/demo_02.mov
Binary file not shown.
Binary file added fonts/bahij-janna-bold.ttf
Binary file not shown.
Binary file added fonts/bahij-janna-regular.ttf
Binary file not shown.
37 changes: 37 additions & 0 deletions lib/_i18n/translations.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

import 'package:flutter/widgets.dart';

class Translations {
Translations(this.locale);

final Locale locale;

static Translations of(BuildContext context) {
return Localizations.of<Translations>(context, Translations);
}

static Map<String, Map<String, String>> _localizedValues = {
'en': {
'title': 'i18n Demo',
'message': 'Hello World',
'change_language': 'تبديل اللغة',
},
'ar': {
'title': 'مثال i18n',
'message': 'مرحباً',
'change_language': 'Change language',
},
};

String get title {
return _localizedValues[locale.languageCode]['title'];
}

String get message {
return _localizedValues[locale.languageCode]['message'];
}

String get changeLanguage {
return _localizedValues[locale.languageCode]['change_language'];
}
}
22 changes: 22 additions & 0 deletions lib/_i18n/translations_delegate.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'dart:async';

import 'package:flutter/widgets.dart';
import 'package:flutter/foundation.dart' show SynchronousFuture;
import 'package:tourism_demo/_i18n/translations.dart';

class TranslationsDelegate
extends LocalizationsDelegate<Translations> {
const TranslationsDelegate();

@override
bool isSupported(Locale locale) => ['en', 'ar'].contains(locale.languageCode);

@override
Future<Translations> load(Locale locale) {
return new SynchronousFuture<Translations>(
new Translations(locale));
}

@override
bool shouldReload(TranslationsDelegate old) => false;
}
41 changes: 21 additions & 20 deletions lib/data.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import 'package:iraqiairways_demo/models/models.dart';

import 'package:tourism_demo/models/models.dart';

List<Destination> getDestinations() {
List<Destination> destinations = new List();
Expand Down Expand Up @@ -47,7 +48,7 @@ List<Destination> getDestinations() {
emoji: '🇹🇷',
photo: 'images/TURKEY-COUNTRY-IMAGE.jpg',
price: 900,
numDays: 8,
numDays: 7,
airlines: 'Turkish Airlines',
airlnesAr: 'الخطوط الجوية التركية',
food: 'Breakfast',
Expand All @@ -56,7 +57,7 @@ List<Destination> getDestinations() {
shortDescription: '8 days in a 4-star hotels/ Turkish Airlines',
shortDescriptionAr: '8 أيام في فندق أربع نجوم / الخطوط الجوية التركية ',
dateFrom: new DateTime(2018, 06, 13),
dateTo: new DateTime(2018, 06, 21),
dateTo: new DateTime(2018, 06, 20),
cityActivities: [
new CityActivity(
cityName: 'Istanbul',
Expand Down Expand Up @@ -99,7 +100,7 @@ List<Destination> getDestinations() {
emoji: '🇹🇷',
photo: 'images/Bodrum.jpg',
price: 780,
numDays: 8,
numDays: 10,
airlines: 'Iraqi Airlines (Charter)',
airlnesAr: 'الخطوط الجوية العراقية (چارتر)',
food: 'Breakfast',
Expand All @@ -109,7 +110,7 @@ List<Destination> getDestinations() {
shortDescriptionAr:
'8 أيام في فندق خمس نجوم / الخطوط الجوية العراقية (جارتر)',
dateFrom: new DateTime(2018, 06, 15),
dateTo: new DateTime(2018, 06, 21),
dateTo: new DateTime(2018, 06, 25),
cityActivities: [
new CityActivity(
cityName: 'Istanbul',
Expand Down Expand Up @@ -152,7 +153,7 @@ List<Destination> getDestinations() {
emoji: '🇺🇦',
photo: 'images/ukraine.jpg',
price: 1850,
numDays: 8,
numDays: 5,
airlines: 'Iraqi Airlines (Charter)',
airlnesAr: 'الخطوط الجوية العراقية (چارتر)',
food: 'Breakfast and dinner',
Expand All @@ -161,7 +162,7 @@ List<Destination> getDestinations() {
shortDescription: '8 days in a 4-star hotels/ Turkish Airlines',
shortDescriptionAr: '8 أيام في فندق أربع نجوم / الخطوط الجوية العراقية',
dateFrom: new DateTime(2018, 06, 12),
dateTo: new DateTime(2018, 06, 20),
dateTo: new DateTime(2018, 06, 18),
cityActivities: [
new CityActivity(
cityName: 'Kiev',
Expand All @@ -188,7 +189,7 @@ List<Destination> getDestinations() {
emoji: '🇦🇲',
photo: 'images/Armenia1.jpg',
price: 700,
numDays: 8,
numDays: 10,
airlines: 'Iraqi Airlines (Charter)',
airlnesAr: 'الخطوط الجوية العراقية (چارتر)',
food: 'Breakfast and dinner',
Expand All @@ -198,7 +199,7 @@ List<Destination> getDestinations() {
shortDescriptionAr:
'8 أيام في فندق أربع نجوم / الخطوط الجوية العراقية (جارتر)',
dateFrom: new DateTime(2018, 06, 16),
dateTo: new DateTime(2018, 06, 24),
dateTo: new DateTime(2018, 06, 26),
cityActivities: [
new CityActivity(
cityName: 'Kiev',
Expand All @@ -225,7 +226,7 @@ List<Destination> getDestinations() {
emoji: '🇹🇳',
photo: 'images/Tunisia tourisim.jpg',
price: 1100,
numDays: 8,
numDays: 12,
airlines: 'Royal Jordanian',
airlnesAr: 'الملكية الاردنية',
food: 'Breakfast and dinner',
Expand All @@ -234,7 +235,7 @@ List<Destination> getDestinations() {
shortDescription: '8 days - five-star hotels / Royal Jordanian',
shortDescriptionAr: '8 أيام في فندق خمس نجوم / الملكية الاردنية',
dateFrom: new DateTime(2018, 06, 15),
dateTo: new DateTime(2018, 06, 23),
dateTo: new DateTime(2018, 06, 27),
cityActivities: [
new CityActivity(
cityName: 'Yasmine Hammamet',
Expand Down Expand Up @@ -266,12 +267,12 @@ List<Destination> getDestinations() {
airlnesAr: 'الخطوط الجوية العراقية',
food: 'Breakfast, launch, and dinner',
foodAr: 'فطور و غداء و عشاء',
hotelStars: 5,
hotelStars: 7,
shortDescription: '8 days - five and four-star hotels / Iraqi Airlines',
shortDescriptionAr:
'8 أيام في فندق أربع و خمس نجوم / الخطوط الجوية العراقية',
dateFrom: new DateTime(2018, 06, 14),
dateTo: new DateTime(2018, 06, 22),
dateTo: new DateTime(2018, 06, 21),
cityActivities: [
new CityActivity(
cityName: 'Cairo',
Expand Down Expand Up @@ -339,12 +340,12 @@ List<Destination> getDestinations() {

// 9) Sea Trip
destinations.add(Destination(
title: 'Sea Trip: Lebanon, Trukey and Greece',
titleAr: 'الرحلة البحرية - لبنان و تركيا و اليونان',
title: 'Sea Trip',
titleAr: 'الرحلة البحرية',
emoji: '🛥 🇱🇧 🇹🇷 🇬🇷',
photo: 'images/tourist-boat-trip.jpg',
price: 1750,
numDays: 8,
numDays: 14,
airlines: 'Middle East Airlines',
airlnesAr: 'خطوط الشرق الاوسط اللبنانية',
food: 'Breakfast, launch, and dinner',
Expand All @@ -355,7 +356,7 @@ List<Destination> getDestinations() {
shortDescriptionAr:
'8 أيام في فندق أربع و خمس نجوم / خطوط الشرق الاوسط اللبنانية',
dateFrom: new DateTime(2018, 06, 13),
dateTo: new DateTime(2018, 06, 26),
dateTo: new DateTime(2018, 06, 27),
cityActivities: [
new CityActivity(
cityName: 'Beirut',
Expand Down Expand Up @@ -390,17 +391,17 @@ List<Destination> getDestinations() {
emoji: '🇮🇩',
photo: 'images/indonesia.jpg',
price: 1350,
numDays: 8,
numDays: 14,
airlines: 'Iraqi Airlines',
airlnesAr: 'الخطوط الجوية العراقية',
food: 'Breakfast',
foodAr: 'فطور',
hotelStars: 5,
hotelStars: 10,
shortDescription: '8 days - five and four-star hotels / Iraqi Airlines',
shortDescriptionAr:
'8 أيام في فندق أربع و خمس نجوم / الخطوط الجوية العراقية ',
dateFrom: new DateTime(2018, 06, 15),
dateTo: new DateTime(2018, 06, 23),
dateTo: new DateTime(2018, 06, 25),
cityActivities: [
new CityActivity(
cityName: 'Kuala Lumpur',
Expand Down
124 changes: 88 additions & 36 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import 'package:flutter/material.dart';
import 'package:iraqiairways_demo/app_styles.dart';
import 'package:iraqiairways_demo/data.dart';
import 'package:iraqiairways_demo/models/models.dart';
import 'package:iraqiairways_demo/scale_route.dart';
import 'package:iraqiairways_demo/ui/destination_info.dart';
import 'package:iraqiairways_demo/ui/destination_item.dart';
import 'package:tourism_demo/app_colors.dart';
import 'package:tourism_demo/app_styles.dart';
import 'package:tourism_demo/data.dart';
import 'package:tourism_demo/models/models.dart';
import 'package:tourism_demo/scale_route.dart';
import 'package:tourism_demo/scoped_model_wrapper.dart';
import 'package:tourism_demo/ui/destination_info.dart';
import 'package:tourism_demo/ui/destination_item.dart';
import 'package:tourism_demo/utils.dart';

void main() => runApp(new MyApp());
void main() => runApp(new ScopeModelWrapper());

class MyApp extends StatelessWidget {
@override
Expand All @@ -32,8 +35,8 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
var destinations = getDestinations();

void _openEventDetails(BuildContext context, Destination destination) {
debugPrint('will _openEventDetails... ');
void _openDestinationDetails(BuildContext context, Destination destination) {
debugPrint('will _openDestinationDetails... ');
Navigator.push(
context,
new FadeRoute(
Expand All @@ -49,33 +52,82 @@ class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
body: new Container(
decoration: gradientBackDecoration(),
child: new ListView(
children: destinations
.map((d) => (new Hero(
tag: d.photo,
child: new Material(
elevation: 0.0,
color: Colors.transparent,
child: DestinationCard(
initialDelay: 500,
destination: d,
onTapped: () => _openEventDetails(context, d),
),
),
)))
.toList()),
)),
theme: appTheme(),
home: new Stack(
fit: StackFit.expand,
alignment: Alignment.bottomCenter,
children: <Widget>[
new Container(
decoration: gradientBackDecoration(),
child: new Container(
decoration: new BoxDecoration(boxShadow: [
new BoxShadow(
color: Colors.black12,
blurRadius: 30.0,
offset: const Offset(0.0, 30.0)),
]),
),
),
new Scaffold(
backgroundColor: Colors.transparent,
body: infoInScrollView(),
)
],
),
);
}
}

//
// NotchedClipper(radius: 15.0,
// topLeft: false,
// bottomLeft: true,
// bottomRight: true,
// topRight: false,
// ),
CustomScrollView infoInScrollView() {
return CustomScrollView(
// physics: new PageScrollPhysics(),
slivers: <Widget>[
new SliverAppBar(
floating: true,
pinned: false,
snap: true,
elevation: 0.0,
backgroundColor: Colors.transparent,
automaticallyImplyLeading: true,
leading: new InkWell(
onTap: () => debugPrint(''),
child: Icon(
Icons.arrow_back,
color: AppColors.whiteColor,
),
),
title: new Text('Tourism Demo'),
centerTitle: true,
actions: <Widget>[
new FlatButton(
child: new Text('إضافة',
style:
TextStyle(color: AppColors.whiteColor, fontSize: 18.0, fontFamily: 'BJ Bold')),
onPressed: () {
debugPrint('');
},
),
],
),
new SliverPadding(
padding: const EdgeInsets.all(10.0),
sliver: new SliverList(
delegate: new SliverChildListDelegate([
new Column(
children: destinations
.map((d) => (new Hero(
tag: d.photo,
child: DestinationCard(
initialDelay: 500,
destination: d,
onTapped: () =>
_openDestinationDetails(context, d),
),
)))
.toList()),
]),
),
)
],
);
}
}
32 changes: 32 additions & 0 deletions lib/scoped_model_wrapper.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:scoped_model/scoped_model.dart';
import 'package:tourism_demo/main.dart';

class ScopeModelWrapper extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ScopedModel<AppModel>(model: AppModel(), child: MyApp());
}
}

class AppModel extends Model {
static const Locale arLocale = Locale('ar');
static const Locale enLocale = Locale('en');

Locale _appLocale = arLocale;
Locale get appLocal => _appLocale ?? arLocale;

List<Locale> get supportedLocales => [
enLocale,
arLocale,
];

void chagneLanguge() {
if (_appLocale == arLocale) {
_appLocale = enLocale;
} else {
_appLocale = arLocale;
}
notifyListeners();
}
}
Loading

0 comments on commit 3e8b73e

Please sign in to comment.