50 lines
1.4 KiB
Dart
50 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:tetra_stats/data_objects/tetrio.dart';
|
|
import 'package:tetra_stats/widgets/tl_thingy.dart';
|
|
import 'package:tetra_stats/widgets/user_thingy.dart';
|
|
|
|
class StateView extends StatefulWidget {
|
|
final TetrioPlayer state;
|
|
const StateView({Key? key, required this.state}) : super(key: key);
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => StateState();
|
|
}
|
|
|
|
class StateState extends State<StateView> {
|
|
late ScrollController _scrollController;
|
|
|
|
@override
|
|
void initState() {
|
|
_scrollController = ScrollController();
|
|
super.initState();
|
|
}
|
|
|
|
void _justUpdate() {
|
|
setState(() {});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text("${widget.state.username.toUpperCase()} account on ${widget.state.state}"),
|
|
),
|
|
backgroundColor: Colors.black,
|
|
body: SafeArea(
|
|
child: NestedScrollView(
|
|
controller: _scrollController,
|
|
headerSliverBuilder: (context, value) {
|
|
return [
|
|
SliverToBoxAdapter(
|
|
child: UserThingy(
|
|
player: widget.state,
|
|
showStateTimestamp: true,
|
|
setState: _justUpdate,
|
|
))
|
|
];
|
|
},
|
|
body: TLThingy(tl: widget.state.tlSeason1, userID: widget.state.userId))));
|
|
}
|
|
}
|