Skip to content

Commit

Permalink
Merge pull request #73 from Jesse-Lucas1996/jesse/web-desktop-support
Browse files Browse the repository at this point in the history
works on chrome and macos
  • Loading branch information
hungps authored Feb 25, 2023
2 parents ecc2f4b + dd6f18e commit 95e721f
Show file tree
Hide file tree
Showing 80 changed files with 3,237 additions and 232 deletions.
41 changes: 38 additions & 3 deletions .metadata
Original file line number Diff line number Diff line change
@@ -1,10 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
# This file should be version controlled.

version:
revision: 362b999b90d53859aa7b926a59c970f3ea31abf4
channel: dev
revision: 9944297138845a94256f1cf37beb88ff9a8e811a
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
- platform: android
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
- platform: ios
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
- platform: linux
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
- platform: macos
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
- platform: web
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
- platform: windows
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.hungps.flutter_pokedex

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
71 changes: 50 additions & 21 deletions lib/configs/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,69 @@ class Themings {
);

static final ThemeData darkTheme = ThemeData(
primarySwatch: Colors.blue,
backgroundColor: AppColors.black,
brightness: Brightness.dark,
primaryColor: AppColors.blue,
appBarTheme: AppBarTheme(
toolbarTextStyle: darkText,
visualDensity: VisualDensity.adaptivePlatformDensity,
colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue)
.copyWith(secondary: Colors.blueAccent, brightness: Brightness.dark),
switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return Colors.blue;
}
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return Colors.blue;
}
return null;
}),
),
textTheme: TextTheme(
bodyText1: darkText,
bodyText2: darkText,
labelMedium: darkText,
caption: darkText,
button: darkText,
overline: darkText,
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return Colors.blue;
}
return null;
}),
),
checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return Colors.blue;
}
return null;
}),
),
scaffoldBackgroundColor: AppColors.black,
);

static final ThemeData lightTheme = ThemeData(
primarySwatch: Colors.blue,
backgroundColor: AppColors.whiteGrey,
brightness: Brightness.light,
primaryColor: AppColors.blue,
appBarTheme: AppBarTheme(
toolbarTextStyle: lightText,
),
textTheme: TextTheme(
bodyText1: lightText,
bodyText2: lightText,
bodyLarge: lightText,
bodyMedium: lightText,
labelMedium: lightText,
caption: lightText,
button: lightText,
overline: lightText,
bodySmall: lightText,
labelLarge: lightText,
labelSmall: lightText,
),
scaffoldBackgroundColor: AppColors.lightGrey,
colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue)
.copyWith(background: AppColors.whiteGrey),
);
}
10 changes: 7 additions & 3 deletions lib/ui/screens/home/home.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: unnecessary_null_comparison

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

Expand Down Expand Up @@ -35,7 +37,9 @@ class _HomeScreenState extends State<HomeScreen> {

@override
void dispose() {
_scrollController.dispose();
if (_scrollController != null) {
_scrollController.dispose();
}

super.dispose();
}
Expand Down Expand Up @@ -80,8 +84,8 @@ class _HomeScreenState extends State<HomeScreen> {
'Pokedex',
style: Theme.of(context)
.appBarTheme
.toolbarTextStyle!
.copyWith(fontWeight: FontWeight.bold),
.toolbarTextStyle
?.copyWith(fontWeight: FontWeight.bold),
),
),
background: _HeaderCardContent(),
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/screens/home/sections/header_card_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class _HeaderCardContent extends StatelessWidget {
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
// color: Colors.white,
borderRadius: BorderRadius.vertical(bottom: Radius.circular(30)),
borderRadius: BorderRadius.vertical(bottom: Radius.circular(10)),
// border: Border(
// bottom: BorderSide(
// color: Colors.white,
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/screens/items/sections/fab_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class _FabMenuState extends State<_FabMenu> with SingleTickerProviderStateMixin

return AnimatedOverlay(
animation: _fabAnimation,
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
onPress: _toggleFabMenu,
child: Container(
alignment: Alignment.bottomRight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class _PokemonAbout extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.12),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Stat extends StatelessWidget {
flex: 2,
child: Text(
label,
style: TextStyle(color: Theme.of(context).textTheme.caption!.color!.withOpacity(0.6)),
style: TextStyle(color: Theme.of(context).textTheme.bodySmall!.color!.withOpacity(0.6)),
),
),
Expanded(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class _PokemonOverallInfoState extends State<_PokemonOverallInfo> with TickerPro
}

Widget _buildPokemonName() {
var bgColor = Theme.of(context).backgroundColor;
var bgColor = Theme.of(context).colorScheme.background;
return Padding(
padding: EdgeInsets.symmetric(horizontal: 26),
child: Row(
Expand Down Expand Up @@ -204,7 +204,7 @@ class _PokemonOverallInfoState extends State<_PokemonOverallInfo> with TickerPro
animation: _horizontalSlideController,
child: Text(
pokemon.genera,
style: TextStyle(color: Theme.of(context).backgroundColor),
style: TextStyle(color: Theme.of(context).colorScheme.background),
),
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/screens/types/modal_draggable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ModalDraggable extends StatelessWidget {
builder: (b, s) {
return Container(
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
borderRadius:
BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))),
child: Stack(
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/fab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FabItem extends StatelessWidget {

@override
Widget build(BuildContext context) {
var bgColor = Theme.of(context).backgroundColor;
var bgColor = Theme.of(context).colorScheme.background;
return MaterialButton(
shape: StadiumBorder(),
padding: EdgeInsets.fromLTRB(24, 8, 16, 8),
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/main_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class MainSliverAppBar extends SliverAppBar {
final dx = startX + endX - endX * percent;

return Container(
color: Theme.of(context).backgroundColor.withOpacity(0.8 - percent * 0.8),
color: Theme.of(context).colorScheme.background.withOpacity(0.8 - percent * 0.8),
child: Stack(
fit: StackFit.expand,
children: <Widget>[
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/main_tab_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MainTabView extends StatelessWidget {
child: Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.vertical(top: Radius.circular(30)),
),
child: Column(
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Modal extends StatelessWidget {
return Container(
padding: EdgeInsets.only(top: 14),
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.only(
topLeft: _borderRadius,
topRight: _borderRadius,
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/pokemon_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class _CardContent extends StatelessWidget {
fontSize: 14,
height: 0.7,
fontWeight: FontWeight.bold,
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/pokemon_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PokemonType extends StatelessWidget {

@override
Widget build(BuildContext context) {
var bgColor = Theme.of(context).backgroundColor;
var bgColor = Theme.of(context).colorScheme.background;
return Material(
color: Colors.transparent,
child: Container(
Expand Down
1 change: 1 addition & 0 deletions linux/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flutter/ephemeral
Loading

0 comments on commit 95e721f

Please sign in to comment.