rsflutterapp

Bahnhofsfoto-App for Android and iOS using Flutter
git clone git://archive.git.mtrnord.blog/MTRNord/rsflutterapp.git
Log | Files | Refs | README

commit 0ab42680c51605fd221eff8dbab4b08149701b40
parent 08dfeb9c7f5e16ac26212ae93e6de55a3de7c972
Author: Marcel <mtrnord1@gmail.com>
Date:   Sun, 23 Feb 2020 19:25:30 +0100

Add crowns to Ranking

Took 10 minutes

Diffstat:
Aanalysis_options.yaml | 11+++++++++++
Aassets/crown_bronze.svg | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aassets/crown_gold.svg | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aassets/crown_silver.svg | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mlib/models/stations.dart | 8++++----
Mlib/views/DetailsPage.dart | 2+-
Mlib/views/tabs/rankingsTab.dart | 55+++++++++++++++++++++++++++++++++++++++++++++++--------
Mpubspec.lock | 21+++++++++++++++++++++
Mpubspec.yaml | 7++++---
9 files changed, 271 insertions(+), 16 deletions(-)

diff --git a/analysis_options.yaml b/analysis_options.yaml @@ -0,0 +1,11 @@ +include: package:pedantic/analysis_options.yaml + +linter: + rules: + - camel_case_types + +analyzer: + errors: + todo: ignore + exclude: + - lib/generated_plugin_registrant.dart diff --git a/assets/crown_bronze.svg b/assets/crown_bronze.svg @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="210mm" + height="297mm" + viewBox="0 0 744.09448819 1052.3622047" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="crown_bronze.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.98977031" + inkscape:cx="154.09708" + inkscape:cy="318.19461" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1920" + inkscape:window-height="1029" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <path + style="fill:#965a38;fill-opacity:1;stroke:none;stroke-width:0.72814417" + d="m 386.85976,269.32976 c 23.71203,9.19388 4.23342,53.65664 -17.29632,32.79302 -12.21314,-12.5211 -1.98722,-40.08872 17.29632,-32.79302 z m 190.77376,12.03668 c 27.33835,11.1616 -3.00874,58.68652 -20.30159,28.24452 -7.59098,-13.20536 3.69974,-34.97267 20.30159,-28.24452 z m -337.13073,20.61099 c 23.71202,9.19388 4.23341,53.65664 -17.29632,32.79302 -12.37231,-12.32009 -1.78206,-40.21398 17.29632,-32.79302 z M 156.5696,483.64446 c 11.34996,20.02064 36.69214,33.04809 58.40864,21.02121 30.08436,-13.23665 40.8482,-53.79477 25.0587,-81.61634 -10.3106,-18.61783 -13.46463,-47.67531 8.85871,-58.90349 20.58446,-10.49344 39.95502,11.80516 38.81713,31.68857 -0.79519,23.28951 8.40205,51.77838 31.42954,61.02183 30.34473,-2.60845 44.45148,-38.27068 46.4653,-65.03126 -5.85053,-27.03109 24.01528,-61.41288 48.62646,-36.25573 19.31931,23.66665 -2.99849,54.34691 7.06551,80.90816 4.69423,28.68704 40.9791,31.09468 55.60289,8.66025 19.40101,-18.69751 27.93549,-44.53704 37.69335,-68.77246 17.45355,-29.50952 56.49664,2.99444 41.06682,29.40278 -9.09622,25.45973 -15.66225,55.83539 -4.26075,81.47425 15.49997,23.53599 47.47384,18.50965 69.92028,9.28945 -22.37395,26.66446 -72.25458,35.54004 -94.32289,3.67609 -8.392,-6.77225 -7.84971,-35.6602 -17.51134,-13.33432 -26.25298,33.19756 -84.46387,40.9916 -111.6905,4.98079 -7.07808,-15.087 -10.79756,-19.08604 -19.72992,-4.16349 -19.2868,22.13839 -52.4043,39.53575 -80.76951,23.43792 -13.92013,-9.77511 -20.60829,-18.80217 -27.16162,1.5604 -21.66914,31.84477 -70.86187,44.04369 -101.51794,18.08028 -23.96051,-23.20681 -30.99732,-57.75228 -36.6092,-89.22318 6.70933,14.82449 15.04871,28.90427 24.56034,42.09829 z M 89.776902,392.81525 c 30.985948,3.41505 8.150324,59.94308 -14.363823,31.78082 -8.529382,-11.44285 -1.755001,-33.3869 14.363823,-31.78082 z m 594.165648,26.00643 c 23.71202,9.19386 4.23343,53.65668 -17.29629,32.79305 -12.37229,-12.32008 -1.78207,-40.21395 17.29629,-32.79305 z M 204.09556,634.79456 c 48.96074,-51.83733 122.75814,-71.10012 192.23006,-70.39012 58.98383,3.48923 121.88218,16.15352 164.63733,60.18696 8.28531,6.09188 26.67251,39.91901 8.661,20.07478 -37.52981,-38.8331 -89.47016,-65.32523 -144.24178,-64.33648 -74.87596,-2.44358 -147.33357,24.84282 -213.79009,57.02946 -5.51098,2.47192 -25.00161,17.90457 -19.07843,9.77572 3.62729,-4.33011 7.70997,-8.23755 11.58191,-12.34032 z" + id="Selection" + inkscape:connector-curvature="0" /> + </g> +</svg> diff --git a/assets/crown_gold.svg b/assets/crown_gold.svg @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="210mm" + height="297mm" + viewBox="0 0 744.09448819 1052.3622047" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="crown_gold.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.3997466" + inkscape:cx="288.44764" + inkscape:cy="502.54053" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1920" + inkscape:window-height="1029" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <path + style="fill:#ffe046;fill-opacity:1;stroke:none;stroke-width:0.72814417" + d="m 386.85976,328.02619 c 31.212,15.84544 -12.57682,62.39984 -22.08086,22.9696 -3.52648,-15.25587 10.09685,-28.63306 22.08086,-22.9696 z m 190.77376,12.11283 c 31.13511,15.78397 -12.59795,62.38566 -22.1071,23.00275 -3.62682,-15.08078 10.23187,-28.80718 22.1071,-23.00275 z m -337.13073,20.7414 c 31.21199,15.84545 -12.57683,62.39983 -22.08086,22.9696 -3.63068,-15.08269 10.21645,-28.74744 22.08086,-22.9696 z M 156.5696,543.69689 c 13.385,23.14083 40.00059,33.12987 61.36069,19.66064 24.4433,-11.38026 38.08081,-50.41316 23.35615,-77.47722 -11.52598,-19.30285 -14.83246,-52.28326 7.60921,-62.43812 20.86147,-11.47415 42.15666,13.84359 38.9365,38.86557 -0.54046,28.68183 25.48946,71.17443 50.9701,47.09101 23.38046,-17.56789 26.61761,-51.93638 29.61572,-81.30663 9.35709,-38.94377 63.11195,-20.47305 53.7775,18.38677 -5.75058,25.13473 -6.81984,63.56427 18.74991,73.33925 23.96849,6.027 42.85995,-20.86547 55.46014,-41.50515 12.49625,-16.1278 11.15222,-45.68578 31.04898,-53.2311 31.17044,-10.21148 36.69763,36.14179 22.19477,58.93301 -6.71738,26.90691 -8.84069,69.21368 20.14746,77.86455 17.14662,6.01619 34.92655,0.78971 51.52545,-5.21382 -23.74609,26.29893 -67.13478,35.49942 -92.11455,6.55474 -10.63168,-10.89665 -10.36795,-39.50715 -22.80939,-12.94402 -31.20524,33.88586 -89.94217,37.25197 -114.91113,-7.95526 -7.90616,-14.57686 -23.11541,25.07106 -37.79252,25.70196 -23.84915,16.32504 -55.02898,10.95758 -75.32836,-10.49283 -19.86971,48.24704 -81.63773,64.60726 -115.47021,27.702 -18.54247,-22.35798 -25.87916,-54.18104 -30.88676,-83.90001 6.81793,15.15217 15.19254,29.28859 24.56034,42.36466 z M 89.776902,452.29298 c 31.063668,2.99569 6.802114,61.9392 -14.363823,31.98191 -9.410275,-12.84417 0.220294,-34.37215 14.363823,-31.98191 z m 594.165648,26.17098 c 31.21199,15.84542 -12.57681,62.39992 -22.08083,22.96961 -3.63066,-15.08263 10.21643,-28.74741 22.08083,-22.96961 z M 204.09556,695.80334 c 50.00877,-52.36734 118.6726,-69.56029 183.77273,-70.8355 60.53122,2.05442 125.26751,12.69055 173.09466,60.56778 12.09813,10.35032 25.53899,41.64579 4.76747,16.27063 -40.01807,-39.94552 -91.70989,-62.33798 -144.04532,-60.92495 -73.06267,-1.34972 -144.52382,25.1637 -211.33641,58.28672 -6.56153,3.37881 -29.86259,21.33334 -13.94687,4.67162 l 4.09433,-4.27834 3.59941,-3.75796 0,0 z" + id="Selection" + inkscape:connector-curvature="0" /> + </g> +</svg> diff --git a/assets/crown_silver.svg b/assets/crown_silver.svg @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="210mm" + height="297mm" + viewBox="0 0 744.09448819 1052.3622047" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="crown_silver.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.98977031" + inkscape:cx="66.504646" + inkscape:cy="317.21263" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1920" + inkscape:window-height="1029" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <path + style="fill:#cccccc;fill-opacity:1;stroke:none;stroke-width:0.72814417" + d="m 368.67372,369.35297 c 23.71203,9.19388 4.23342,53.65664 -17.29632,32.79302 -12.21314,-12.5211 -1.98722,-40.08872 17.29632,-32.79302 z m 190.77376,12.03668 c 27.33835,11.1616 -3.00874,58.68652 -20.30159,28.24452 -7.67619,-13.11608 3.82643,-35.04968 20.30159,-28.24452 z m -337.13073,20.61099 c 23.71202,9.19388 4.23341,53.65664 -17.29632,32.79302 -12.21314,-12.52107 -1.98722,-40.08879 17.29632,-32.79302 z m -83.93319,181.66703 c 11.34996,20.02064 36.69214,33.04809 58.40864,21.02121 30.08436,-13.23665 40.8482,-53.79477 25.0587,-81.61634 -10.3106,-18.61783 -13.46463,-47.67531 8.85871,-58.90349 20.58446,-10.49344 39.95502,11.80516 38.81713,31.68857 -0.79519,23.28951 8.40205,51.77838 31.42954,61.02183 30.34473,-2.60845 44.45148,-38.27068 46.4653,-65.03126 -5.85053,-27.03109 24.01528,-61.41288 48.62646,-36.25573 19.31931,23.66665 -2.99849,54.34691 7.06551,80.90816 4.69423,28.68704 40.9791,31.09468 55.60289,8.66025 19.40101,-18.69751 27.93549,-44.53704 37.69335,-68.77246 17.45355,-29.50952 56.49664,2.99444 41.06682,29.40278 -9.09622,25.45973 -15.66225,55.83539 -4.26075,81.47425 15.49997,23.53599 47.47384,18.50965 69.92028,9.28945 -22.37395,26.66446 -72.25458,35.54004 -94.32289,3.67609 -8.392,-6.77225 -7.84971,-35.6602 -17.51134,-13.33432 -26.25298,33.19756 -84.46387,40.9916 -111.6905,4.98079 -7.07808,-15.087 -10.79756,-19.08604 -19.72992,-4.16349 -19.2868,22.13839 -52.4043,39.53575 -80.76951,23.43792 -13.92013,-9.77511 -20.60829,-18.80217 -27.16162,1.5604 -21.66914,31.84477 -70.86187,44.04369 -101.51794,18.08028 -23.96051,-23.20681 -30.99732,-57.75228 -36.6092,-89.22318 6.70933,14.82449 15.04871,28.90427 24.56034,42.09829 z M 71.590865,492.83846 c 30.985945,3.41505 8.150324,59.94308 -14.363823,31.78082 -8.529382,-11.44285 -1.755001,-33.3869 14.363823,-31.78082 z m 594.165645,26.00643 c 23.71202,9.19386 4.23343,53.65668 -17.29629,32.79305 -12.37229,-12.32008 -1.78207,-40.21395 17.29629,-32.79305 z M 185.90952,734.81777 c 48.96074,-51.83733 122.75814,-71.10012 192.23006,-70.39012 58.98383,3.48923 121.88218,16.15352 164.63733,60.18696 8.28531,6.09188 26.67251,39.91901 8.661,20.07478 -37.52981,-38.8331 -89.47016,-65.32523 -144.24178,-64.33648 -74.87596,-2.44358 -147.33357,24.84282 -213.79009,57.02946 -5.51098,2.47192 -25.00161,17.90457 -19.07843,9.77572 3.62729,-4.33011 7.70997,-8.23755 11.58191,-12.34032 z" + id="Selection" + inkscape:connector-curvature="0" /> + </g> +</svg> diff --git a/lib/models/stations.dart b/lib/models/stations.dart @@ -56,16 +56,16 @@ class Station extends Equatable { return Station( country: json["country"] ?? "", idStr: json["idStr"] ?? "", - id: json["id"] ?? null, + id: json["id"] ?? -1, title: json["title"] ?? "", - lat: json["lat"] ?? null, - lon: json["lon"] ?? null, + lat: json["lat"] ?? 0, + lon: json["lon"] ?? 0, photographer: json["photographer"] ?? "", photographerUrl: json["photographerUrl"] ?? "", photoUrl: json["photoUrl"] ?? "", license: json["license"] ?? "", licenseUrl: json["licenseUrl"] ?? "", - createdAt: json["createdAt"] ?? null, + createdAt: json["createdAt"] ?? 0, active: json["active"] ?? false, ds100: json["DS100"] ?? "", ); diff --git a/lib/views/DetailsPage.dart b/lib/views/DetailsPage.dart @@ -34,7 +34,7 @@ class DetailsPage extends StatelessWidget { onPressed: () async { Country country = (await railwayStationsRepository.getCountries()) .firstWhere((element) => element.code == station.country); - launch(country.timetableUrlTemplate + await launch(country.timetableUrlTemplate .replaceAll("{id}", station.idStr) .replaceAll("{title}", station.title) .replaceAll("{DS100}", station.ds100)); diff --git a/lib/views/tabs/rankingsTab.dart b/lib/views/tabs/rankingsTab.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import '../../repos/repositories.dart'; class RankingsTab extends StatelessWidget { @@ -37,15 +38,53 @@ class RankingsTab extends StatelessWidget { return Divider(); }, itemBuilder: (BuildContext context, int index) { - return ListTile( - leading: Text( - "${(index + 1)}.", - style: TextStyle( - fontWeight: FontWeight.bold, + if (index == 0) { + return ListTile( + leading: SvgPicture.asset( + "assets/crown_gold.svg", + semanticsLabel: 'Golden Crown', + width: 50, + height: 50, ), - ), - title: Text(scores[index][1]), - ); + title: Text(scores[index][1]), + ); + } else if (index == 1) { + return ListTile( + leading: SvgPicture.asset( + "assets/crown_silver.svg", + semanticsLabel: 'Silver Crown', + width: 50, + height: 50, + ), + title: Text(scores[index][1]), + ); + } else if (index == 2) { + return ListTile( + leading: SvgPicture.asset( + "assets/crown_bronze.svg", + semanticsLabel: 'Bronze Crown', + width: 50, + height: 50, + ), + title: Text(scores[index][1]), + ); + } else { + return ListTile( + leading: SizedBox( + width: 50, + height: 50, + child: Center( + child: Text( + "${(index + 1)}.", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + ), + ), + title: Text(scores[index][1]), + ); + } }, ); } diff --git a/pubspec.lock b/pubspec.lock @@ -179,6 +179,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.2.7" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + url: "https://pub.dartlang.org" + source: hosted + version: "0.17.1" flutter_test: dependency: "direct dev" description: flutter @@ -369,6 +376,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.6.4" + path_drawing: + dependency: transitive + description: + name: path_drawing + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" path_provider: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml @@ -39,6 +39,8 @@ dependencies: flutter_cache_manager: ^1.1.3 grizzly_io: ^2.2.0 + flutter_svg: ^0.17.1 + dev_dependencies: flutter_test: sdk: flutter @@ -59,9 +61,8 @@ flutter: uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg + assets: + - assets/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.