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(
|
||||||
|
child: body,
|
||||||
|
onChangePage: (newPage) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_sec = newPage;
|
_sec = newPage;
|
||||||
});
|
});
|
||||||
}, child: body);
|
},
|
||||||
|
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;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -42,11 +42,13 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
},
|
},
|
||||||
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(
|
||||||
|
onPressed: () {
|
||||||
loginCtx.onLoggin(false);
|
loginCtx.onLoggin(false);
|
||||||
Token.getInstance().setToken("", "");
|
Token.getInstance().setToken("", "");
|
||||||
Db().clear();
|
Db().clear();
|
||||||
}, child: Text("Logout"))
|
},
|
||||||
|
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",
|
||||||
|
{'MovieId': widget.vdata.movieId});
|
||||||
final d = jsonDecode(data);
|
final d = jsonDecode(data);
|
||||||
if (d["result"] != 'success') {
|
if (d["result"] != 'success') {
|
||||||
Log.w(d);
|
Log.w(d);
|
||||||
}
|
}
|
||||||
// bit hacky but it works
|
// bit hacky but it works
|
||||||
widget.vdata.likes += 1;
|
widget.vdata.likes += 1;
|
||||||
}, icon: Icon(Icons.thumb_up)),
|
},
|
||||||
|
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