fix linting
add routename in privider
This commit is contained in:
parent
01049d9381
commit
c732ab31df
@ -1,14 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:openmediacentermobile/navigation/settings_screen.dart';
|
import 'package:openmediacentermobile/navigation/settings_screen.dart';
|
||||||
import 'db/database.dart';
|
|
||||||
import 'navigation/actor_screen.dart';
|
import 'navigation/actor_screen.dart';
|
||||||
import 'navigation/categorie_screen.dart';
|
import 'navigation/categorie_screen.dart';
|
||||||
import 'navigation/shufflescreen.dart';
|
import 'navigation/shufflescreen.dart';
|
||||||
import 'navigation/video_feed.dart';
|
import 'navigation/video_feed.dart';
|
||||||
|
|
||||||
import 'api/token.dart';
|
|
||||||
import 'login/logincontext.dart';
|
|
||||||
|
|
||||||
class DrawerPage extends StatefulWidget {
|
class DrawerPage extends StatefulWidget {
|
||||||
const DrawerPage({Key? key, required this.title}) : super(key: key);
|
const DrawerPage({Key? key, required this.title}) : super(key: key);
|
||||||
|
|
||||||
@ -55,11 +51,15 @@ class _DrawerPageState extends State<DrawerPage> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DrawerContext((newPage) {
|
return DrawerContext(
|
||||||
setState(() {
|
child: body,
|
||||||
_sec = newPage;
|
onChangePage: (newPage) {
|
||||||
});
|
setState(() {
|
||||||
}, child: body);
|
_sec = newPage;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
routeName: title,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,12 +117,16 @@ class MyDrawer extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class DrawerContext extends InheritedWidget {
|
class DrawerContext extends InheritedWidget {
|
||||||
const DrawerContext(this.onChangePage, {Key? key, required Widget child})
|
const DrawerContext({
|
||||||
: super(key: key, child: child);
|
Key? key,
|
||||||
|
required Widget child,
|
||||||
|
required this.onChangePage,
|
||||||
|
required this.routeName,
|
||||||
|
}) : super(key: key, child: child);
|
||||||
|
|
||||||
final void Function(Section) onChangePage;
|
final void Function(Section) onChangePage;
|
||||||
|
final String routeName;
|
||||||
|
|
||||||
static DrawerContext of(BuildContext context) {
|
static DrawerContext of(BuildContext context) {
|
||||||
final DrawerContext? result =
|
final DrawerContext? result =
|
||||||
@ -135,9 +139,4 @@ class DrawerContext extends InheritedWidget {
|
|||||||
bool updateShouldNotify(covariant InheritedWidget oldWidget) {
|
bool updateShouldNotify(covariant InheritedWidget oldWidget) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @override
|
|
||||||
// bool updateShouldNotify(LoginContext old) {
|
|
||||||
// return loggedIn != old.loggedIn;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -51,9 +51,9 @@ class Db {
|
|||||||
/// get db size in bytes
|
/// get db size in bytes
|
||||||
Future<int> getDbSize() async {
|
Future<int> getDbSize() async {
|
||||||
final int cnt = (await Db().db().rawQuery("pragma page_count;"))[0]
|
final int cnt = (await Db().db().rawQuery("pragma page_count;"))[0]
|
||||||
["page_count"] as int;
|
["page_count"] as int;
|
||||||
final int pagesize =
|
final int pagesize =
|
||||||
(await Db().db().rawQuery("pragma page_size;"))[0]["page_size"] as int;
|
(await Db().db().rawQuery("pragma page_size;"))[0]["page_size"] as int;
|
||||||
return cnt * pagesize;
|
return cnt * pagesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ class _CategorieScreenState extends State<CategorieScreen> {
|
|||||||
alignment: WrapAlignment.start,
|
alignment: WrapAlignment.start,
|
||||||
children: snapshot.data!
|
children: snapshot.data!
|
||||||
.map((e) => TagTile(
|
.map((e) => TagTile(
|
||||||
tag: e,
|
tag: e,
|
||||||
))
|
))
|
||||||
.toList(growable: false),
|
.toList(growable: false),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -37,16 +37,18 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Db().clear();
|
await Db().clear();
|
||||||
Db().getDbSize().then((v) => setState(() {
|
Db().getDbSize().then((v) => setState(() {
|
||||||
dbsize = v;
|
dbsize = v;
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
child: const Text("Delete cache!")),
|
child: const Text("Delete cache!")),
|
||||||
Text("db size: ${dbsize / 1024} kb"),
|
Text("db size: ${dbsize / 1024} kb"),
|
||||||
ElevatedButton(onPressed: () {
|
ElevatedButton(
|
||||||
loginCtx.onLoggin(false);
|
onPressed: () {
|
||||||
Token.getInstance().setToken("", "");
|
loginCtx.onLoggin(false);
|
||||||
Db().clear();
|
Token.getInstance().setToken("", "");
|
||||||
}, child: Text("Logout"))
|
Db().clear();
|
||||||
|
},
|
||||||
|
child: Text("Logout"))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
drawer: MyDrawer());
|
drawer: MyDrawer());
|
||||||
|
@ -57,16 +57,18 @@ class _InfoViewState extends State<InfoView> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("Likes: ${widget.vdata.likes}"),
|
Text("Likes: ${widget.vdata.likes}"),
|
||||||
IconButton(onPressed: () async {
|
IconButton(
|
||||||
final data = await API
|
onPressed: () async {
|
||||||
.query("video", "addLike", {'MovieId': widget.vdata.movieId});
|
final data = await API.query("video", "addLike",
|
||||||
final d = jsonDecode(data);
|
{'MovieId': widget.vdata.movieId});
|
||||||
if (d["result"] != 'success') {
|
final d = jsonDecode(data);
|
||||||
Log.w(d);
|
if (d["result"] != 'success') {
|
||||||
}
|
Log.w(d);
|
||||||
// bit hacky but it works
|
}
|
||||||
widget.vdata.likes += 1;
|
// bit hacky but it works
|
||||||
}, icon: Icon(Icons.thumb_up)),
|
widget.vdata.likes += 1;
|
||||||
|
},
|
||||||
|
icon: Icon(Icons.thumb_up)),
|
||||||
Text("Quality: ${widget.vdata.quality}"),
|
Text("Quality: ${widget.vdata.quality}"),
|
||||||
Text("Length: ${widget.vdata.length}sec"),
|
Text("Length: ${widget.vdata.length}sec"),
|
||||||
Text("Actors:"),
|
Text("Actors:"),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
import '../api/api.dart';
|
import '../api/api.dart';
|
||||||
import '../api/token.dart';
|
import '../api/token.dart';
|
||||||
|
Loading…
Reference in New Issue
Block a user