Skip to content

Commit

Permalink
Adding introduction sliders
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfoehrKn committed Aug 4, 2019
1 parent 3aaa822 commit 901d199
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 45 deletions.
Binary file added assets/intro/intro_slider_1.png
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 assets/intro/intro_slider_2.png
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 assets/intro/intro_slider_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ PODS:
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- intro_slider (0.0.1):
- Flutter
- MobilePlayer (1.3.0)
- path_provider (0.0.1):
- Flutter
- screen (0.0.1):
- Flutter
- shared_preferences (0.0.1):
- Flutter
- sqflite (0.0.1):
- Flutter
- FMDB (~> 2.7.2)
Expand All @@ -26,9 +30,11 @@ DEPENDENCIES:
- device_info (from `.symlinks/plugins/device_info/ios`)
- Flutter (from `.symlinks/flutter/ios`)
- flutter_downloader (from `.symlinks/plugins/flutter_downloader/ios`)
- intro_slider (from `.symlinks/plugins/intro_slider/ios`)
- MobilePlayer (~> 1.3.0)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- screen (from `.symlinks/plugins/screen/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- video_player (from `.symlinks/plugins/video_player/ios`)
Expand All @@ -46,10 +52,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/flutter/ios"
flutter_downloader:
:path: ".symlinks/plugins/flutter_downloader/ios"
intro_slider:
:path: ".symlinks/plugins/intro_slider/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
screen:
:path: ".symlinks/plugins/screen/ios"
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher:
Expand All @@ -64,9 +74,11 @@ SPEC CHECKSUMS:
Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
flutter_downloader: 058b9c41564a90500f67f3e432e3524613a7fd83
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
intro_slider: 85847639533bfd8e898d76844e0aa2cf412ee190
MobilePlayer: e50e2160830f3db51d6e08067318aec6a9d39408
path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259
screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0
shared_preferences: 1feebfa37bb57264736e16865e7ffae7fc99b523
sqflite: ff1d9da63c06588cc8d1faf7256d741f16989d5a
url_launcher: 0067ddb8f10d36786672aa0722a21717dba3a298
video_player: 3964090a33353060ed7f58aa6427c7b4b208ec21
Expand Down
116 changes: 71 additions & 45 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ import 'package:flutter_ws/widgets/bars/indexing_bar.dart';
import 'package:flutter_ws/widgets/bars/status_bar.dart';
import 'package:flutter_ws/widgets/filterMenu/filter_menu.dart';
import 'package:flutter_ws/widgets/filterMenu/search_filter.dart';
import 'package:flutter_ws/widgets/introSlider/intro_slider.dart';
import 'package:flutter_ws/widgets/videolist/video_list_view.dart';
import 'package:flutter_ws/widgets/videolist/videolist_util.dart';
import 'package:logging/logging.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:uuid/uuid.dart';

void main() => runApp(new AppSharedStateContainer(child: new MyApp()));
Expand All @@ -49,6 +51,7 @@ class MyApp extends StatelessWidget {
Uuid uuid = new Uuid();

return new MaterialApp(
debugShowCheckedModeBanner: false,
theme: new ThemeData(
textTheme: new TextTheme(
subhead: subHeaderTextStyle,
Expand Down Expand Up @@ -152,6 +155,10 @@ class HomePageState extends State<MyHomePage>
DownloadSection downloadSection;
AboutSection aboutSection;

//intro slider
SharedPreferences prefs;
bool isFirstStart = false;

HomePageState(this.searchFieldController, this.logger);

@override
Expand Down Expand Up @@ -212,57 +219,21 @@ class HomePageState extends State<MyHomePage>
});

startSocketHealthTimer();
}

void startSocketHealthTimer() {
if (socketHealthTimer == null || !socketHealthTimer.isActive) {
Duration duration = new Duration(milliseconds: 5000);
Timer.periodic(
duration,
(Timer t) {
ConnectionState connectionState = websocketController.connectionState;

if (connectionState == ConnectionState.active) {
logger.fine("Ws connection is fine");
consecutiveWebsocketUnhealthyChecks = 0;
if (websocketInitError) {
websocketInitError = false;
if (mounted) setState(() {});
}
} else if (connectionState == ConnectionState.done ||
connectionState == ConnectionState.none) {
showStatusBar();

logger.fine("Ws connection is " +
connectionState.toString() +
" and mounted: " +
mounted.toString());

if (mounted)
websocketController
.initializeWebsocket()
.then((initializedSuccessfully) {
if (initializedSuccessfully) {
consecutiveWebsocketUnhealthyChecks = 0;
logger.info("WS connection stable again");
if (videos.isEmpty) {
_createQuery();
}
} else {
logger.info("WS initialization failed");
}
});
}
},
);
}
checkForFirstStart();
}

@override
Widget build(BuildContext context) {
stateContainer = AppSharedStateContainer.of(context);

logger.fine("Rendering Home Page");
if (isFirstStart) {
return new IntroScreen(onDonePressed: () {
setState(() {
isFirstStart = false;
prefs.setBool('firstStart', false);
});
});
}

return new Scaffold(
backgroundColor: Colors.grey[800],
Expand Down Expand Up @@ -630,6 +601,61 @@ class HomePageState extends State<MyHomePage>
}
}

checkForFirstStart() async {
prefs = await SharedPreferences.getInstance();
var firstStart = prefs.getBool('firstStart');
if (firstStart == null) {
print("First start");
setState(() {
isFirstStart = true;
});
}
}

void startSocketHealthTimer() {
if (socketHealthTimer == null || !socketHealthTimer.isActive) {
Duration duration = new Duration(milliseconds: 5000);
Timer.periodic(
duration,
(Timer t) {
ConnectionState connectionState = websocketController.connectionState;

if (connectionState == ConnectionState.active) {
logger.fine("Ws connection is fine");
consecutiveWebsocketUnhealthyChecks = 0;
if (websocketInitError) {
websocketInitError = false;
if (mounted) setState(() {});
}
} else if (connectionState == ConnectionState.done ||
connectionState == ConnectionState.none) {
showStatusBar();

logger.fine("Ws connection is " +
connectionState.toString() +
" and mounted: " +
mounted.toString());

if (mounted)
websocketController
.initializeWebsocket()
.then((initializedSuccessfully) {
if (initializedSuccessfully) {
consecutiveWebsocketUnhealthyChecks = 0;
logger.info("WS connection stable again");
if (videos.isEmpty) {
_createQuery();
}
} else {
logger.info("WS initialization failed");
}
});
}
},
);
}
}

mockIndexing() {
if (mockTimer == null || !mockTimer.isActive) {
var one = new Duration(seconds: 1);
Expand Down
72 changes: 72 additions & 0 deletions lib/widgets/introSlider/intro_slider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import 'package:flutter/material.dart';
import 'package:intro_slider/intro_slider.dart';
import 'package:intro_slider/slide_object.dart';

class IntroScreen extends StatefulWidget {
var onDonePressed;
IntroScreen({Key key, this.onDonePressed}) : super(key: key);

@override
IntroScreenState createState() => new IntroScreenState();
}

class IntroScreenState extends State<IntroScreen> {
List<Slide> slides = new List();

@override
void initState() {
super.initState();

slides.add(
new Slide(
title: "Suchen und Downloaden",
maxLineTitle: 2,
marginTitle: new EdgeInsets.only(top: 20.0, bottom: 20.0),
description: "Durchsuchen von öffentlich-rechtlichen Mediatheken.",
//pathImage: "assets/intro/intro_slider_1.png",
centerWidget: new Container(
padding: EdgeInsets.only(left: 20.0, right: 20.0),
child: new Image(
image: new AssetImage("assets/intro/intro_slider_1.png"))),
backgroundColor: Color(0xfff5a623),
),
);
slides.add(
new Slide(
title: "Filtern",
description: "Filtern nach Thema, Titel, Länge und Fernsehsender",
//pathImage: "assets/intro/intro_slider_2.png",
centerWidget: new Container(
padding: EdgeInsets.only(left: 20.0, right: 20.0),
child: new Image(
image: new AssetImage("assets/intro/intro_slider_2.png"))),

backgroundColor: Color(0xff203152),
),
);
slides.add(
new Slide(
title: "Bewerten",
description: "Bewerte deine Lieblingssendungen",
//pathImage: "assets/intro/intro_slider_3.png",
centerWidget: new Container(
padding: EdgeInsets.only(left: 20.0, right: 20.0),
child: new Image(
image: new AssetImage("assets/intro/intro_slider_3.png"))),
backgroundColor: Color(0xff9932CC),
),
);
}

void onDonePress() {
widget.onDonePressed();
}

@override
Widget build(BuildContext context) {
return new IntroSlider(
slides: this.slides,
onDonePress: this.onDonePress,
);
}
}
14 changes: 14 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
intro_slider:
dependency: "direct main"
description:
name: intro_slider
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.5"
json_object_lite:
dependency: "direct main"
description:
Expand Down Expand Up @@ -256,6 +263,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.5"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.3+4"
shimmer:
dependency: "direct main"
description:
Expand Down
5 changes: 5 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ dependencies:
chewie: '^0.9.7'
wakelock: '^0.1.2+7'
flutter_launcher_icons: "^0.7.0"
shared_preferences: "^0.5.3+4"
intro_slider: "^2.2.5"

flutter:
sdk: flutter
Expand Down Expand Up @@ -69,6 +71,9 @@ flutter:
- assets/img/srf.png
- assets/img/MediathekViewLoading.png
- assets/default_live_stream_channels.txt
- assets/intro/intro_slider_1.png
- assets/intro/intro_slider_2.png
- assets/intro/intro_slider_3.png

fonts:
- family: OldStandard
Expand Down

0 comments on commit 901d199

Please sign in to comment.