fix notificationPredicate and tl_thingy for anon player

This commit is contained in:
dan63047 2024-01-22 21:56:43 +03:00
parent d0ead79068
commit e26ae3a6b8
2 changed files with 11 additions and 10 deletions

View File

@ -312,13 +312,13 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
onRefresh: () {
return Future(() => changePlayer(snapshot.data![0].userId));
},
// notificationPredicate: (notification) {
// // with NestedScrollView local(depth == 2) OverscrollNotification are not sent
// if (!kIsWeb && (notification is OverscrollNotification || Platform.isIOS)) {
// return notification.depth == 2;
// }
// return notification.depth == 0;
// },
notificationPredicate: (notification) {
// with NestedScrollView local(depth == 2) OverscrollNotification are not sent
if (!kIsWeb && (notification is OverscrollNotification || Platform.isIOS)) {
return notification.depth == 2;
}
return notification.depth == 0;
},
child: NestedScrollView(
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(),
@ -350,7 +350,7 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
body: TabBarView(
controller: _tabController,
children: [
TLThingy(tl: snapshot.data![0].tlSeason1, userID: snapshot.data![0].userId, states: snapshot.data![2], topTR: snapshot.data![7], bot: snapshot.data![0].role == "bot"),
TLThingy(tl: snapshot.data![0].tlSeason1, userID: snapshot.data![0].userId, states: snapshot.data![2], topTR: snapshot.data![7], bot: snapshot.data![0].role == "bot", guest: snapshot.data![0].role == "anon"),
_TLRecords(userID: snapshot.data![0].userId, data: snapshot.data![3]),
_History(states: snapshot.data![2], update: _justUpdate),
_RecordThingy(record: (snapshot.data![1]['sprint'].isNotEmpty) ? snapshot.data![1]['sprint'][0] : null),

View File

@ -21,8 +21,9 @@ class TLThingy extends StatefulWidget {
final List<TetrioPlayer> states;
final bool showTitle;
final bool bot;
final bool guest;
final double? topTR;
const TLThingy({super.key, required this.tl, required this.userID, required this.states, this.showTitle = true, this.bot=false, this.topTR});
const TLThingy({super.key, required this.tl, required this.userID, required this.states, this.showTitle = true, this.bot=false, this.guest=false, this.topTR});
@override
State<TLThingy> createState() => _TLThingyState();
@ -409,7 +410,7 @@ class _TLThingyState extends State<TLThingy> {
if (currentTl.nerdStats != null) Graphs(currentTl.apm!, currentTl.pps!, currentTl.vs!, currentTl.nerdStats!, currentTl.playstyle!)
]
: [
Text(widget.bot ? t.botTL : t.neverPlayedTL, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28)),
Center(child: Text(widget.guest ? t.anonTL : widget.bot ? t.botTL : t.neverPlayedTL, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28), textAlign: TextAlign.center,)),
],
);
},