1 small fix + redesign thoughts
This commit is contained in:
parent
31659d646d
commit
b93898cc34
|
@ -30,8 +30,9 @@ ThemeData theme = ThemeData(
|
||||||
colorScheme: const ColorScheme.dark(
|
colorScheme: const ColorScheme.dark(
|
||||||
primary: Colors.cyanAccent,
|
primary: Colors.cyanAccent,
|
||||||
surface: Color.fromARGB(255, 10, 10, 10),
|
surface: Color.fromARGB(255, 10, 10, 10),
|
||||||
secondary: Colors.white
|
secondary: Colors.white,
|
||||||
),
|
),
|
||||||
|
cardTheme: CardTheme(surfaceTintColor: Color.fromARGB(255, 10, 10, 10)),
|
||||||
scaffoldBackgroundColor: Colors.black
|
scaffoldBackgroundColor: Colors.black
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart' hide Badge;
|
import 'package:flutter/material.dart' hide Badge;
|
||||||
import 'package:flutter/rendering.dart';
|
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
@ -30,6 +28,17 @@ class MainView extends StatefulWidget {
|
||||||
State<MainView> createState() => _MainState();
|
State<MainView> createState() => _MainState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum Cards {overview, tetraLeague, quickPlay, quickPlayExpert, sprint, blitz, other}
|
||||||
|
Map<Cards, String> cardsTitles = {
|
||||||
|
Cards.overview: "Overview",
|
||||||
|
Cards.tetraLeague: t.tetraLeague,
|
||||||
|
Cards.quickPlay: t.quickPlay,
|
||||||
|
Cards.quickPlayExpert: "${t.quickPlay} ${t.expert}",
|
||||||
|
Cards.sprint: t.sprint,
|
||||||
|
Cards.blitz: t.blitz,
|
||||||
|
Cards.other: t.other
|
||||||
|
};
|
||||||
|
|
||||||
TetrioPlayer testPlayer = TetrioPlayer(
|
TetrioPlayer testPlayer = TetrioPlayer(
|
||||||
userId: "6098518e3d5155e6ec429cdc",
|
userId: "6098518e3d5155e6ec429cdc",
|
||||||
username: "dan63",
|
username: "dan63",
|
||||||
|
@ -85,209 +94,234 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(body: Row(
|
return Scaffold(
|
||||||
children: [
|
body: LayoutBuilder(
|
||||||
NavigationRail(
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
destinations: [
|
return Row(
|
||||||
NavigationRailDestination(
|
children: [
|
||||||
icon: Icon(Icons.favorite_border),
|
NavigationRail(
|
||||||
selectedIcon: Icon(Icons.favorite),
|
leading: FloatingActionButton(
|
||||||
label: Text('First'),
|
elevation: 0,
|
||||||
),
|
onPressed: () {
|
||||||
NavigationRailDestination(
|
// Add your onPressed code here!
|
||||||
icon: Icon(Icons.bookmark_border),
|
},
|
||||||
selectedIcon: Icon(Icons.book),
|
child: const Icon(Icons.search),
|
||||||
label: Text('Second'),
|
),
|
||||||
),
|
trailing: IconButton(
|
||||||
NavigationRailDestination(
|
onPressed: () {
|
||||||
icon: Icon(Icons.star_border),
|
// Add your onPressed code here!
|
||||||
selectedIcon: Icon(Icons.star),
|
},
|
||||||
label: Text('Third'),
|
icon: const Icon(Icons.more_horiz_rounded),
|
||||||
)
|
),
|
||||||
],
|
destinations: const [
|
||||||
selectedIndex: 0
|
NavigationRailDestination(
|
||||||
),
|
icon: Icon(Icons.home),
|
||||||
Expanded(
|
selectedIcon: Icon(Icons.home),
|
||||||
child: Scrollbar(
|
label: Text('First'),
|
||||||
controller: controller,
|
),
|
||||||
thumbVisibility: true,
|
NavigationRailDestination(
|
||||||
child: SingleChildScrollView(
|
icon: Icon(Icons.leaderboard),
|
||||||
controller: controller,
|
selectedIcon: Icon(Icons.leaderboard),
|
||||||
scrollDirection: Axis.horizontal,
|
label: Text('Second'),
|
||||||
child: Row(
|
),
|
||||||
mainAxisSize: MainAxisSize.min,
|
NavigationRailDestination(
|
||||||
children: [
|
icon: Icon(Icons.compress),
|
||||||
SizedBox(
|
selectedIcon: Icon(Icons.compress),
|
||||||
width: 450.0,
|
label: Text('Third'),
|
||||||
child: Column(
|
),
|
||||||
children: [
|
NavigationRailDestination(
|
||||||
NewUserThingy(player: testPlayer, showStateTimestamp: false, setState: setState),
|
icon: Icon(Icons.calculate),
|
||||||
Padding(
|
selectedIcon: Icon(Icons.calculate),
|
||||||
padding: const EdgeInsets.fromLTRB(4.0, 0.0, 4.0, 0.0),
|
label: Text('Calc'),
|
||||||
child: Row(
|
),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
NavigationRailDestination(
|
||||||
children: [
|
icon: Icon(Icons.settings),
|
||||||
Expanded(child: ElevatedButton.icon(onPressed: (){print("ok, and?");}, icon: Icon(Icons.person_add), label: Text(t.track), style: ButtonStyle(shape: MaterialStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.circular(12.0), right: Radius.zero)))))),
|
selectedIcon: Icon(Icons.settings),
|
||||||
Expanded(child: ElevatedButton.icon(onPressed: (){print("ok, and?");}, icon: Icon(Icons.balance), label: Text(t.compare), style: ButtonStyle(shape: MaterialStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.zero, right: Radius.circular(12.0)))))))
|
label: Text('Third'),
|
||||||
],
|
)
|
||||||
|
],
|
||||||
|
selectedIndex: 0
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 450.0,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
NewUserThingy(player: testPlayer, showStateTimestamp: false, setState: setState),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(4.0, 0.0, 4.0, 0.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Expanded(child: ElevatedButton.icon(onPressed: (){print("ok, and?");}, icon: Icon(Icons.person_add), label: Text(t.track), style: ButtonStyle(shape: MaterialStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.circular(12.0), right: Radius.zero)))))),
|
||||||
|
Expanded(child: ElevatedButton.icon(onPressed: (){print("ok, and?");}, icon: Icon(Icons.balance), label: Text(t.compare), style: ButtonStyle(shape: MaterialStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.zero, right: Radius.circular(12.0)))))))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Card(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text("Badges", style: TextStyle(fontFamily: "Eurostile Round Extended")),
|
||||||
|
Spacer(),
|
||||||
|
Text(intf.format(testPlayer.badges.length))
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
SingleChildScrollView(
|
||||||
Card(
|
scrollDirection: Axis.horizontal,
|
||||||
surfaceTintColor: theme.colorScheme.surface,
|
child: Row(
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
for (var badge in testPlayer.badges)
|
||||||
Padding(
|
IconButton(
|
||||||
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
|
onPressed: () => showDialog<void>(
|
||||||
child: Row(
|
context: context,
|
||||||
children: [
|
builder: (BuildContext context) {
|
||||||
Text("Badges", style: TextStyle(fontFamily: "Eurostile Round Extended")),
|
return AlertDialog(
|
||||||
Spacer(),
|
title: Text(badge.label, style: const TextStyle(fontFamily: "Eurostile Round Extended")),
|
||||||
Text(intf.format(testPlayer.badges.length))
|
content: SingleChildScrollView(
|
||||||
],
|
child: ListBody(
|
||||||
),
|
children: [
|
||||||
),
|
Wrap(
|
||||||
SingleChildScrollView(
|
direction: Axis.horizontal,
|
||||||
scrollDirection: Axis.horizontal,
|
alignment: WrapAlignment.center,
|
||||||
child: Row(
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
children: [
|
spacing: 25,
|
||||||
for (var badge in testPlayer.badges)
|
|
||||||
IconButton(
|
|
||||||
onPressed: () => showDialog<void>(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text(badge.label, style: const TextStyle(fontFamily: "Eurostile Round Extended")),
|
|
||||||
content: SingleChildScrollView(
|
|
||||||
child: ListBody(
|
|
||||||
children: [
|
children: [
|
||||||
Wrap(
|
Image.asset("res/tetrio_badges/${badge.badgeId}.png"),
|
||||||
direction: Axis.horizontal,
|
Text(badge.ts != null
|
||||||
alignment: WrapAlignment.center,
|
? t.obtainDate(date: timestamp(badge.ts!))
|
||||||
crossAxisAlignment: WrapCrossAlignment.center,
|
: t.assignedManualy),
|
||||||
spacing: 25,
|
|
||||||
children: [
|
|
||||||
Image.asset("res/tetrio_badges/${badge.badgeId}.png"),
|
|
||||||
Text(badge.ts != null
|
|
||||||
? t.obtainDate(date: timestamp(badge.ts!))
|
|
||||||
: t.assignedManualy),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
child: Text(t.popupActions.ok),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
),
|
||||||
},
|
|
||||||
),
|
),
|
||||||
tooltip: badge.label,
|
actions: <Widget>[
|
||||||
icon: Image.asset(
|
TextButton(
|
||||||
"res/tetrio_badges/${badge.badgeId}.png",
|
child: Text(t.popupActions.ok),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
tooltip: badge.label,
|
||||||
|
icon: Image.asset(
|
||||||
|
"res/tetrio_badges/${badge.badgeId}.png",
|
||||||
|
height: 32,
|
||||||
|
width: 32,
|
||||||
|
errorBuilder: (context, error, stackTrace) {
|
||||||
|
return Image.network(
|
||||||
|
kIsWeb ? "https://ts.dan63.by/oskware_bridge.php?endpoint=TetrioBadge&badge=${badge.badgeId}" : "https://tetr.io/res/badges/${badge.badgeId}.png",
|
||||||
height: 32,
|
height: 32,
|
||||||
width: 32,
|
width: 32,
|
||||||
errorBuilder: (context, error, stackTrace) {
|
errorBuilder:(context, error, stackTrace) {
|
||||||
return Image.network(
|
return Image.asset("res/icons/kagari.png", height: 32, width: 32);
|
||||||
kIsWeb ? "https://ts.dan63.by/oskware_bridge.php?endpoint=TetrioBadge&badge=${badge.badgeId}" : "https://tetr.io/res/badges/${badge.badgeId}.png",
|
}
|
||||||
height: 32,
|
);
|
||||||
width: 32,
|
},
|
||||||
errorBuilder:(context, error, stackTrace) {
|
|
||||||
return Image.asset("res/icons/kagari.png", height: 32, width: 32);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
)
|
),
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
if (testPlayer.distinguishment != null) DistinguishmentThingy(testPlayer.distinguishment!),
|
),
|
||||||
if (testPlayer.bio != null) Card(
|
if (testPlayer.distinguishment != null) DistinguishmentThingy(testPlayer.distinguishment!),
|
||||||
surfaceTintColor: theme.colorScheme.surface,
|
if (testPlayer.bio != null) Card(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
|
||||||
Spacer(),
|
|
||||||
Text(t.bio, style: TextStyle(fontFamily: "Eurostile Round Extended")),
|
|
||||||
Spacer()
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 8.0),
|
|
||||||
child: MarkdownBody(data: testPlayer.bio!, styleSheet: MarkdownStyleSheet(textAlign: WrapAlignment.center)),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
//if (testNews != null && testNews!.news.isNotEmpty)
|
|
||||||
Expanded(child: NewsThingy(testNews))
|
|
||||||
],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 450.0,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Card(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
children: [
|
||||||
Spacer(),
|
Spacer(),
|
||||||
Text("test card"),
|
Text(t.bio, style: TextStyle(fontFamily: "Eurostile Round Extended")),
|
||||||
Spacer()
|
Spacer()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
Padding(
|
||||||
],
|
padding: const EdgeInsets.only(bottom: 8.0),
|
||||||
|
child: MarkdownBody(data: testPlayer.bio!, styleSheet: MarkdownStyleSheet(textAlign: WrapAlignment.center)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
//if (testNews != null && testNews!.news.isNotEmpty)
|
||||||
SizedBox(
|
Expanded(child: NewsThingy(testNews))
|
||||||
width: 450.0,
|
],
|
||||||
child: Column(
|
)
|
||||||
children: [
|
),
|
||||||
Card(
|
SizedBox(
|
||||||
child: Row(
|
width: constraints.maxWidth - 450 - 80,
|
||||||
children: [
|
child: Column(
|
||||||
Spacer(),
|
//crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
Text("test card"),
|
children: [
|
||||||
Spacer()
|
Card(
|
||||||
],
|
child: Row(
|
||||||
),
|
mainAxisSize: MainAxisSize.min,
|
||||||
)
|
children: [
|
||||||
],
|
Spacer(),
|
||||||
|
Text(t.tetraLeague, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)),
|
||||||
|
Spacer()
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Card(),
|
||||||
SizedBox(
|
SegmentedButton<Cards>(
|
||||||
width: 450.0,
|
segments: const <ButtonSegment<Cards>>[
|
||||||
child: Column(
|
ButtonSegment<Cards>(
|
||||||
children: [
|
value: Cards.overview,
|
||||||
Card(
|
label: Text('Overview'),
|
||||||
child: Row(
|
icon: Icon(Icons.calendar_view_day)),
|
||||||
children: [
|
ButtonSegment<Cards>(
|
||||||
Spacer(),
|
value: Cards.tetraLeague,
|
||||||
Text("test card"),
|
label: Text('Tetra League'),
|
||||||
Spacer()
|
icon: Icon(Icons.calendar_view_week)),
|
||||||
],
|
ButtonSegment<Cards>(
|
||||||
),
|
value: Cards.quickPlay,
|
||||||
)
|
label: Text('Quick Play'),
|
||||||
|
icon: Icon(Icons.calendar_view_month)),
|
||||||
|
// ButtonSegment<Cards>(
|
||||||
|
// value: Cards.quickPlayExpert,
|
||||||
|
// label: Text('QP Expert'),
|
||||||
|
// icon: Icon(Icons.calendar_today)),
|
||||||
|
ButtonSegment<Cards>(
|
||||||
|
value: Cards.sprint,
|
||||||
|
label: Text('40 Lines'),
|
||||||
|
icon: Icon(Icons.calendar_today)),
|
||||||
|
ButtonSegment<Cards>(
|
||||||
|
value: Cards.blitz,
|
||||||
|
label: Text('Blitz'),
|
||||||
|
icon: Icon(Icons.calendar_today)),
|
||||||
|
// ButtonSegment<Cards>(
|
||||||
|
// value: Cards.other,
|
||||||
|
// label: Text('Other'),
|
||||||
|
// icon: Icon(Icons.calendar_today)),
|
||||||
],
|
],
|
||||||
),
|
selected: <Cards>{Cards.tetraLeague},
|
||||||
),
|
onSelectionChanged: (Set<Cards> newSelection) {
|
||||||
],
|
setState(() {
|
||||||
|
// By default there is only a single segment that can be
|
||||||
|
// selected at one time, so its value is always the first
|
||||||
|
// item in the selected set.
|
||||||
|
//calendarView = newSelection.first;
|
||||||
|
});})
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
);
|
||||||
],
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,7 +633,6 @@ class NewUserThingy extends StatelessWidget {
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
surfaceTintColor: theme.colorScheme.surface,
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 8.0),
|
padding: const EdgeInsets.only(bottom: 8.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
|
@ -338,7 +338,7 @@ class TlMatchResultState extends State<TlMatchResultView> {
|
||||||
CompareThingy(
|
CompareThingy(
|
||||||
label: t.statCellNum.estOfTRShort,
|
label: t.statCellNum.estOfTRShort,
|
||||||
greenSide: roundSelector == -2 ? timeWeightedStats[0].estTr.esttr :
|
greenSide: roundSelector == -2 ? timeWeightedStats[0].estTr.esttr :
|
||||||
roundSelector.isNegative ? widget.record.results.leaderboard[greenSidePlayer].stats.nerdStats.app : widget.record.results.rounds[roundSelector].firstWhere((element) => element.id == widget.initPlayerId).stats.estTr.esttr,
|
roundSelector.isNegative ? widget.record.results.leaderboard[greenSidePlayer].stats.estTr.esttr : widget.record.results.rounds[roundSelector].firstWhere((element) => element.id == widget.initPlayerId).stats.estTr.esttr,
|
||||||
redSide: roundSelector == -2 ? timeWeightedStats[1].estTr.esttr :
|
redSide: roundSelector == -2 ? timeWeightedStats[1].estTr.esttr :
|
||||||
roundSelector == -1 ? widget.record.results.leaderboard[redSidePlayer].stats.estTr.esttr : widget.record.results.rounds[roundSelector].firstWhere((element) => element.id != widget.initPlayerId).stats.estTr.esttr,
|
roundSelector == -1 ? widget.record.results.leaderboard[redSidePlayer].stats.estTr.esttr : widget.record.results.rounds[roundSelector].firstWhere((element) => element.id != widget.initPlayerId).stats.estTr.esttr,
|
||||||
fractionDigits: 2,
|
fractionDigits: 2,
|
||||||
|
|
Loading…
Reference in New Issue