From 5b675908234e0749d63e1ef9c0a971c95208550c Mon Sep 17 00:00:00 2001 From: pawankumar Date: Wed, 15 May 2019 13:20:35 +0530 Subject: [PATCH] PokemonApp For Web --- lib/main.dart | 10 +- lib/pokemondetail.dart | 2 +- pubspec.lock | 353 ++++++++++++++++++++++++++++++++--- pubspec.yaml | 87 +++++---- web/assets/FontManifest.json | 10 + web/index.html | 11 ++ web/main.dart | 8 + 7 files changed, 415 insertions(+), 66 deletions(-) create mode 100644 web/assets/FontManifest.json create mode 100644 web/index.html create mode 100644 web/main.dart diff --git a/lib/main.dart b/lib/main.dart index 7f30afe..8d9a984 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,6 @@ import 'dart:convert'; -import 'package:flutter/material.dart'; +import 'package:flutter_web/material.dart'; import 'package:http/http.dart' as http; import 'package:pokeappen/pokemon.dart'; import 'package:pokeappen/pokemondetail.dart'; @@ -68,14 +68,18 @@ class HomePageState extends State { tag: poke.img, child: Card( child: Column( + mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( - height: 100.0, - width: 100.0, + height: MediaQuery.of(context).size.height * + 0.4, + width: + MediaQuery.of(context).size.width * 0.2, decoration: BoxDecoration( image: DecorationImage( + fit: BoxFit.cover, image: NetworkImage(poke.img))), ), Text( diff --git a/lib/pokemondetail.dart b/lib/pokemondetail.dart index 61ed787..7b80484 100644 --- a/lib/pokemondetail.dart +++ b/lib/pokemondetail.dart @@ -1,4 +1,4 @@ -import 'package:flutter/material.dart'; +import 'package:flutter_web/material.dart'; import 'package:pokeappen/pokemon.dart'; class PokeDetail extends StatelessWidget { diff --git a/pubspec.lock b/pubspec.lock index 8327ec7..13cd33a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,27 @@ # Generated by pub # See https://www.dartlang.org/tools/pub/glossary#lockfile packages: + analyzer: + dependency: transitive + description: + name: analyzer + url: "https://pub.dartlang.org" + source: hosted + version: "0.36.3" + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.1" async: dependency: transitive description: @@ -8,13 +29,83 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" - boolean_selector: + bazel_worker: + dependency: transitive + description: + name: bazel_worker + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.20" + build: + dependency: transitive + description: + name: build + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.4" + build_config: + dependency: transitive + description: + name: build_config + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.0" + build_daemon: + dependency: transitive + description: + name: build_daemon + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.1" + build_modules: dependency: transitive description: - name: boolean_selector + name: build_modules + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" + build_resolvers: + dependency: transitive + description: + name: build_resolvers url: "https://pub.dartlang.org" source: hosted version: "1.0.4" + build_runner: + dependency: "direct dev" + description: + name: build_runner + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.5" + build_web_compilers: + dependency: "direct dev" + description: + name: build_web_compilers + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + built_collection: + dependency: transitive + description: + name: built_collection + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.2" + built_value: + dependency: transitive + description: + name: built_value + url: "https://pub.dartlang.org" + source: hosted + version: "6.5.0" charcode: dependency: transitive description: @@ -22,6 +113,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.2" + code_builder: + dependency: transitive + description: + name: code_builder + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.0" collection: dependency: transitive description: @@ -29,23 +127,87 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.14.11" - cupertino_icons: - dependency: "direct main" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.0" + dart_style: + dependency: transitive + description: + name: dart_style + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.7" + fixnum: + dependency: transitive description: - name: cupertino_icons + name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" - flutter: + version: "0.10.9" + flutter_web: dependency: "direct main" - description: flutter - source: sdk + description: + path: "packages/flutter_web" + ref: HEAD + resolved-ref: e2728abe0058d8a268881d82061d81e0171bbe86 + url: "https://github.com/flutter/flutter_web" + source: git version: "0.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk + flutter_web_ui: + dependency: "direct main" + description: + path: "packages/flutter_web_ui" + ref: HEAD + resolved-ref: e2728abe0058d8a268881d82061d81e0171bbe86 + url: "https://github.com/flutter/flutter_web" + source: git version: "0.0.0" + front_end: + dependency: transitive + description: + name: front_end + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.18" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.7" + graphs: + dependency: transitive + description: + name: graphs + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0+2" http: dependency: "direct main" description: @@ -53,6 +215,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.0+2" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" http_parser: dependency: transitive description: @@ -60,6 +229,48 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.3" + intl: + dependency: transitive + description: + name: intl + url: "https://pub.dartlang.org" + source: hosted + version: "0.15.8" + io: + dependency: transitive + description: + name: io + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.3" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.1+1" + json_annotation: + dependency: transitive + description: + name: json_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.0" + kernel: + dependency: transitive + description: + name: kernel + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.18" + logging: + dependency: transitive + description: + name: logging + url: "https://pub.dartlang.org" + source: hosted + version: "0.11.3+2" matcher: dependency: transitive description: @@ -74,6 +285,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.6" + mime: + dependency: transitive + description: + name: mime + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.6+2" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + package_resolver: + dependency: transitive + description: + name: package_resolver + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.10" path: dependency: transitive description: @@ -88,6 +320,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.5.0" + pool: + dependency: transitive + description: + name: pool + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" + protobuf: + dependency: transitive + description: + name: protobuf + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.11" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.2" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" quiver: dependency: transitive description: @@ -95,11 +355,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.2" - sky_engine: + scratch_space: + dependency: transitive + description: + name: scratch_space + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.3+2" + shelf: dependency: transitive - description: flutter - source: sdk - version: "0.0.99" + description: + name: shelf + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.5" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.3" + source_maps: + dependency: transitive + description: + name: source_maps + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.8" source_span: dependency: transitive description: @@ -121,6 +404,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + stream_transform: + dependency: transitive + description: + name: stream_transform + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.19" string_scanner: dependency: transitive description: @@ -135,13 +425,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" - test_api: + timing: dependency: transitive description: - name: test_api + name: timing url: "https://pub.dartlang.org" source: hosted - version: "0.2.4" + version: "0.1.1+1" typed_data: dependency: transitive description: @@ -156,5 +446,26 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.7+10" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.12" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.15" sdks: - dart: ">=2.2.0 <3.0.0" + dart: ">=2.3.0-dev.0.1 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index f78ff8b..89412a4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,54 +10,59 @@ description: A new Flutter application. version: 1.0.0+1 environment: - sdk: ">=2.0.0-dev.68.0 <3.0.0" + sdk: ">=2.2.0 <3.0.0" dependencies: - flutter: - sdk: flutter - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 + flutter_web: any + flutter_web_ui: any http: any dev_dependencies: - flutter_test: - sdk: flutter + build_runner: any + build_web_compilers: any +dependency_overrides: + flutter_web: + git: + url: https://github.com/flutter/flutter_web + path: packages/flutter_web + flutter_web_ui: + git: + url: https://github.com/flutter/flutter_web + path: packages/flutter_web_ui # For information on the generic Dart part of this file, see the # following page: https://www.dartlang.org/tools/pub/pubspec # The following section is specific to Flutter. -flutter: - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. - 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 - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.io/assets-and-images/#resolution-aware. - # For details regarding adding assets from package dependencies, see - # https://flutter.io/assets-and-images/#from-packages - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.io/custom-fonts/#from-packages +# flutter: +# The following line ensures that the Material Icons font is +# included with your application, so that you can use the icons in +# the material Icons class. +# 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 +# An image asset can refer to one or more resolution-specific "variants", see +# https://flutter.io/assets-and-images/#resolution-aware. +# For details regarding adding assets from package dependencies, see +# https://flutter.io/assets-and-images/#from-packages +# To add custom fonts to your application, add a fonts section here, +# in this "flutter" section. Each entry in this list should have a +# "family" key with the font family name, and a "fonts" key with a +# list giving the asset and other descriptors for the font. For +# example: +# fonts: +# - family: Schyler +# fonts: +# - asset: fonts/Schyler-Regular.ttf +# - asset: fonts/Schyler-Italic.ttf +# style: italic +# - family: Trajan Pro +# fonts: +# - asset: fonts/TrajanPro.ttf +# - asset: fonts/TrajanPro_Bold.ttf +# weight: 700 +# +# For details regarding fonts from package dependencies, +# see https://flutter.io/custom-fonts/#from-packages diff --git a/web/assets/FontManifest.json b/web/assets/FontManifest.json new file mode 100644 index 0000000..43fa689 --- /dev/null +++ b/web/assets/FontManifest.json @@ -0,0 +1,10 @@ +[ + { + "family": "MaterialIcons", + "fonts": [ + { + "asset": "https://fonts.gstatic.com/s/materialicons/v42/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2" + } + ] + } +] diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..365395c --- /dev/null +++ b/web/index.html @@ -0,0 +1,11 @@ + + + + + + + PokemonApp + + + + diff --git a/web/main.dart b/web/main.dart new file mode 100644 index 0000000..105f789 --- /dev/null +++ b/web/main.dart @@ -0,0 +1,8 @@ +import 'package:flutter_web_ui/ui.dart' as ui; + +import 'package:pokeappen/main.dart' as app; + +main() async { + await ui.webOnlyInitializePlatform(); + app.main(); +}