Skip to content

Commit

Permalink
v 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseChip committed Aug 13, 2020
1 parent 44f6c5a commit 88ec2e8
Show file tree
Hide file tree
Showing 20 changed files with 261 additions and 74 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
Um zu erfahren, wie Artikel für die App erstellt werden, lies dir bitte die [Wiki][wiki] durch. Dort findest du alle Informationen zum erstellen eines Artikels und Beispiele für jeden Artikeltypen der unterstützt wird.

## Changelog
* 1.1.3
* Added: Web version / checks
* Added: CDot option (use \cdot instead of \times)
* Fixed: Sub-Menu page title now displays the topics name
* Changed: Android Target SDK updated to 29
* 1.1.2
* Added: Intro Slider
* Added: Dark Blue Theme
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ android {
defaultConfig {
applicationId "de.thebotdev.physik_lp_app"
minSdkVersion 16
targetSdkVersion 28
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package de.thebotdev.physik_lk

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
27 changes: 19 additions & 8 deletions lib/core/platform/appinfo.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
import 'package:package_info/package_info.dart';

abstract class AppInfo{
abstract class AppInfo {
String get appVersion;
String get appName;
}

class AppInfoImpl implements AppInfo{
final PackageInfo _packageInfo;
class AppInfoImpl implements AppInfo {
final PackageInfo packageInfo;

AppInfoImpl(this._packageInfo);
AppInfoImpl({this.packageInfo});
@override
String get appName => _packageInfo.appName;
String get appName {
if (packageInfo != null) {
return packageInfo.appName;
} else {
return "Web App";
}
}

@override
String get appVersion => _packageInfo.version;

}
String get appVersion {
if (packageInfo != null) {
return packageInfo.version;
} else {
return "v.1.1.3";
}
}
}
17 changes: 11 additions & 6 deletions lib/core/platform/networkinfo.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import 'package:data_connection_checker/data_connection_checker.dart';

abstract class NetworkInfo{
abstract class NetworkInfo {
Future<bool> get isConnected;
}

class NetworkInfoImpl implements NetworkInfo{
class NetworkInfoImpl implements NetworkInfo {
final DataConnectionChecker connectionChecker;
NetworkInfoImpl(this.connectionChecker);
NetworkInfoImpl({this.connectionChecker});
@override
Future<bool> get isConnected => connectionChecker.hasConnection;

}
Future<bool> get isConnected {
if (connectionChecker != null) {
return connectionChecker.hasConnection;
} else {
return Future.value(true);
}
}
}
11 changes: 11 additions & 0 deletions lib/core/ui/pages/settings/settings_page.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import 'package:flutter/material.dart';
import 'package:list_tile_switch/list_tile_switch.dart';
import 'package:physik_lp_app_rewrite/core/ui/pages/settings/widgets/cdots_chooser.dart';
import 'package:physik_lp_app_rewrite/core/util/shared_prefrences/shared_prefs_cdots.dart';
import 'package:physik_lp_app_rewrite/features/intro_slider/presentation/slider_page.dart';
import '../../../../features/login/presentation/pages/delete_account_page.dart';

import '../../../../injection_container.dart';
import '../../../platform/appinfo.dart';
import 'widgets/drop_down_rendering_engine.dart';
import 'widgets/widgets.dart';
Expand Down Expand Up @@ -48,6 +52,13 @@ class _SettingsPageState extends State<SettingsPage> {
Expanded(child: dropDownRenderingEngine())
],
),
Row(
children: [
Expanded(
child: CDotSetting(),
),
],
),
Row(
children: <Widget>[
Expanded(
Expand Down
32 changes: 32 additions & 0 deletions lib/core/ui/pages/settings/widgets/cdots_chooser.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:list_tile_switch/list_tile_switch.dart';
import 'package:physik_lp_app_rewrite/core/util/shared_prefrences/shared_prefs_cdots.dart';

import '../../../../../injection_container.dart';

class CDotSetting extends StatefulWidget {
CDotSetting({Key key}) : super(key: key);

@override
_CDotSettingState createState() => _CDotSettingState();
}

class _CDotSettingState extends State<CDotSetting> {
bool _value = sl<SharedPrefsCDots>().cDotsSetting;
@override
Widget build(BuildContext context) {
return ListTileSwitch(
value: _value,
onChanged: (value) {
setState(() {
_value = value;
});
sl<SharedPrefsCDots>().cDotsSetting = value;
},
switchActiveColor: Theme.of(context).accentColor,
title: Text(
"CDots",
style: Theme.of(context).primaryTextTheme.bodyText1,
));
}
}
17 changes: 17 additions & 0 deletions lib/core/util/shared_prefrences/shared_prefs_cdots.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'package:flutter/cupertino.dart';
import 'package:shared_preferences/shared_preferences.dart';

class SharedPrefsCDots {
final SharedPreferences prefs;
SharedPrefsCDots({@required this.prefs});

/// Liefert zurück, ob CDots ausgewählt sind, falls nichts gespeichert ist
/// wird false zurück gegeben
bool get cDotsSetting {
return prefs.getBool("cdots_enabled") ?? false;
}

set cDotsSetting(bool setting) {
prefs.setBool("cdots_enabled", setting);
}
}
57 changes: 32 additions & 25 deletions lib/features/content/presentation/pages/articels_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,63 @@ import '../widgets/articels_list_display.dart';
import '../widgets/content_error_display.dart';
import '../widgets/content_loading_display.dart';

final String errorInitial = "Scheint als wäre die Api nicht aufgerufen worden, bitte starte die App noch mal neu";
final String errorInitial =
"Scheint als wäre die Api nicht aufgerufen worden, bitte starte die App noch mal neu";

class ArticelsPage extends StatefulWidget {
final int thema_id;
ArticelsPage({@required this.thema_id});
final int themaId;
final String topicName;
ArticelsPage({@required this.themaId, @required this.topicName});

@override
_ArticelsPageState createState() => _ArticelsPageState(thema_id: thema_id);
_ArticelsPageState createState() =>
_ArticelsPageState(thema_id: themaId, topicName: topicName);
}

class _ArticelsPageState extends State<ArticelsPage> {
final int thema_id;
_ArticelsPageState({@required this.thema_id});
final String topicName;
_ArticelsPageState({this.topicName, @required this.thema_id});
bool madearticelsscall = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Hauptmenü"),),
appBar: AppBar(
title: Text(topicName),
),
body: buildbody(context),
);
}

_getAllArticels(BuildContext context){
BlocProvider.of<ContentBloc>(context).add(GetAllArticelsEvent(id: thema_id));
_getAllArticels(BuildContext context) {
BlocProvider.of<ContentBloc>(context)
.add(GetAllArticelsEvent(id: thema_id));
}

BlocProvider<ContentBloc> buildbody(BuildContext context){
BlocProvider<ContentBloc> buildbody(BuildContext context) {
return BlocProvider(
create: (context) => sl<ContentBloc>(),
child: Column(
children: <Widget>[
create: (context) => sl<ContentBloc>(),
child: Column(children: <Widget>[
BlocBuilder<ContentBloc, ContentState>(
builder: (context, state){
if(!madearticelsscall){
builder: (context, state) {
if (!madearticelsscall) {
madearticelsscall = true;
_getAllArticels(context);
}
if(state is ContentError){
if (state is ContentError) {
return ContentErrorDisplay(error: state.error);
} else if(state is ContentInitial){
} else if (state is ContentInitial) {
return ContentErrorDisplay(error: errorInitial);
} else if(state is ContentLoading){
} else if (state is ContentLoading) {
return ContentLoadingDisplay();
}else if(state is ArticelsLoaded){
} else if (state is ArticelsLoaded) {
return ArticelsListDisplay(state: state);
}else{
return ContentErrorDisplay(error: "Unknown State: "+state.toString());
} else {
return ContentErrorDisplay(
error: "Unknown State: " + state.toString());
}
},)
]
)
);
},
)
]));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'dart:convert';
import 'dart:developer';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_tex/flutter_tex.dart';
import 'package:physik_lp_app_rewrite/core/util/shared_prefrences/shared_prefs_cdots.dart';

import '../../../../../core/util/shared_prefrences/shared_prefs_rendering_engine.dart';
import '../../../../../injection_container.dart';
Expand All @@ -18,6 +20,16 @@ class ArticelRenderer extends StatelessWidget {
Map<String, dynamic> content_json = json.decode(content);
content_json.forEach((_key, value) {
String key = _key.toLowerCase();

/// Wenn CDot aktiviert ist wird das Zeichen verwendet, sonst \times
if (sl<SharedPrefsCDots>().cDotsSetting) {
value = value.toString().replaceAll("\\times", "\\cdot");
} else {
/// Damit alle Artikel immer einhaltlich, entweder \\cdot oder \\times
/// verwenden und das nicht gemischt wird
value = value.toString().replaceAll("\\cdot", "\\times");
}

if (key.startsWith("text")) {
content_list.add(TeXDocument.text(value));
} else if (key.startsWith("image")) {
Expand Down
33 changes: 19 additions & 14 deletions lib/features/content/presentation/widgets/topic_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,28 @@ import '../pages/articels_page.dart';
class TopicCard extends StatelessWidget {
final String topic_name;
final int topic_id;
TopicCard({
@required this.topic_name,
@required this.topic_id});
TopicCard({@required this.topic_name, @required this.topic_id});

@override
Widget build(BuildContext context) {
return Container(
child: Card(
child: Card(
child: ListTile(
contentPadding: EdgeInsets.symmetric(horizontal: 26, vertical: 8),
title: Text(topic_name, style: Theme.of(context).primaryTextTheme.bodyText1),
trailing: Icon(
Icons.arrow_forward_ios,
color: Theme.of(context).dividerColor,
),
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) =>ArticelsPage(thema_id: topic_id,)),)
))
);
contentPadding:
EdgeInsets.symmetric(horizontal: 26, vertical: 8),
title: Text(topic_name,
style: Theme.of(context).primaryTextTheme.bodyText1),
trailing: Icon(
Icons.arrow_forward_ios,
color: Theme.of(context).dividerColor,
),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ArticelsPage(
themaId: topic_id,
topicName: topic_name,
)),
))));
}
}
}
12 changes: 7 additions & 5 deletions lib/features/intro_slider/presentation/slider_page.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:intro_slider/intro_slider.dart';
import 'package:intro_slider/slide_object.dart';

import '../../../core/util/shared_prefrences/shared_prefs_slider.dart';
import '../../../core/util/shared_prefrences/shared_prefs_theme.dart';

import '../../../injection_container.dart';

class SlidersPage extends StatefulWidget {
Expand All @@ -21,16 +21,16 @@ class _SlidersPageState extends State<SlidersPage> {
/// es bei den slides verwenden zu können
Color bgColor =
sl<SharedPrefsTheme>().lastTheme.themeData.scaffoldBackgroundColor;
String urlReadMore = "https://github.com/BaseChip";
String urlReadMore = "https://github.com/BaseChip/App-Physik";

///https://www.freepik.com/vectors/book
///Bilder von: https://www.freepik.com/
@override
void initState() {
super.initState();
slides.add(new Slide(
title: "Zusammenfassungen",
description:
"Lies dir zusammenfassungen für alle Abiturrelevanten Themen durch, falls dir dabei ein Thema fehlt kannst du dies gerne ergänzen",
"Lies dir Zusammenfassungen für alle abiturrelevanten Themen durch, falls dir dabei ein Thema fehlt kannst du dies gerne ergänzen",
pathImage: "assets/articel.png",
backgroundColor: bgColor));
slides.add(new Slide(
Expand All @@ -42,11 +42,13 @@ class _SlidersPageState extends State<SlidersPage> {
slides.add(new Slide(
title: "Ergänze",
description:
"Dir fehlt ein Theme in der App? Kein Problem ergänz es einfach, für dich und für alle die, die App benutzen! Um zu erfahren, wie du eigene Artikel in die App hinzufügen kannst lies dir einfach $urlReadMore durch, dort findest du alle Informationen wie du ganz einfach etwas für alle zur App hinzufügst",
"Dir fehlt ein Theme in der App? Kein Problem ergänz es einfach, für dich und für alle die, welche die App benutzen! Um zu erfahren, wie du eigene Artikel in die App hinzufügen kannst lies dir einfach $urlReadMore durch, dort findest du alle Informationen wie du ganz einfach etwas für alle zur App hinzufügst",
pathImage: "assets/articels.png",
backgroundColor: bgColor));
}

///Speichert, dass jemand das Intro schon bekommen hat und leitet einen auf die
///HomePage weiter
void onDonePressed() {
sl<SharedPrefsSlider>().introGot = true;
Navigator.pushNamedAndRemoveUntil(context, '/', (_) => false);
Expand Down
Loading

0 comments on commit 88ec2e8

Please sign in to comment.