diff --git a/lib/data_classes/champions/player_champions.dart b/lib/data_classes/champions/player_champions.dart index d58494bc..b4baf89a 100644 --- a/lib/data_classes/champions/player_champions.dart +++ b/lib/data_classes/champions/player_champions.dart @@ -1,15 +1,17 @@ class PlayerChampionsSortData { final String iconUrl; final int sortedIndex; + final String name; final String? iconBlurHash; PlayerChampionsSortData({ required this.iconUrl, required this.sortedIndex, + required this.name, this.iconBlurHash, }); int compareTo(PlayerChampionsSortData other) { - return sortedIndex - other.sortedIndex; + return name.compareTo(other.name); } } diff --git a/lib/data_classes/loadout/index.dart b/lib/data_classes/loadout/index.dart index fd87d234..13f58d30 100644 --- a/lib/data_classes/loadout/index.dart +++ b/lib/data_classes/loadout/index.dart @@ -3,4 +3,5 @@ export './loadout.dart' CreateLoadoutScreenArguments, LoadoutValidationResult, DraftLoadout, - ShowLoadoutDetailsOptions; + ShowLoadoutDetailsOptions, + LoadoutScreenArguments; diff --git a/lib/data_classes/loadout/loadout.dart b/lib/data_classes/loadout/loadout.dart index fd46d6c0..53f65797 100644 --- a/lib/data_classes/loadout/loadout.dart +++ b/lib/data_classes/loadout/loadout.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart' hide Card; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:paladinsedge/models/index.dart' - show Champion, Loadout, LoadoutCard, Card; + show Champion, Loadout, LoadoutCard, Card, Player; part 'loadout.freezed.dart'; @@ -54,6 +54,16 @@ class DraftLoadout with _$DraftLoadout { } } +class LoadoutScreenArguments { + final Champion champion; + final Player? player; + + LoadoutScreenArguments({ + required this.champion, + this.player, + }); +} + class ShowLoadoutDetailsOptions { final BuildContext context; final Champion champion; diff --git a/lib/screens/champion_detail/champion_detail.dart b/lib/screens/champion_detail/champion_detail.dart index 6cfcb081..a204e5fe 100644 --- a/lib/screens/champion_detail/champion_detail.dart +++ b/lib/screens/champion_detail/champion_detail.dart @@ -54,8 +54,14 @@ class ChampionDetail extends HookConsumerWidget { ); final _onLoadoutPress = useCallback( - () => Navigator.of(context) - .pushNamed(screens.Loadouts.routeName, arguments: champion), + () { + Navigator.of(context).pushNamed( + screens.Loadouts.routeName, + arguments: data_classes.LoadoutScreenArguments( + champion: champion, + ), + ); + }, [], ); diff --git a/lib/screens/loadouts/loadouts.dart b/lib/screens/loadouts/loadouts.dart index ba1226a8..779f852d 100644 --- a/lib/screens/loadouts/loadouts.dart +++ b/lib/screens/loadouts/loadouts.dart @@ -19,15 +19,21 @@ class Loadouts extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { // Providers final loadoutProvider = ref.read(providers.loadout); - final playerId = ref.read(providers.auth).player?.playerId; + final userPlayerId = ref.read(providers.auth).player?.playerId; final loadouts = ref.watch(providers.loadout.select((_) => _.loadouts)); final isGettingLoadouts = ref.watch(providers.loadout.select((_) => _.isGettingLoadouts)); // Variables final textTheme = Theme.of(context).textTheme; - final champion = - ModalRoute.of(context)?.settings.arguments as models.Champion; + final arguments = ModalRoute.of(context)?.settings.arguments + as data_classes.LoadoutScreenArguments; + final champion = arguments.champion; + final otherPlayer = arguments.player; + final otherPlayerId = otherPlayer?.playerId; + final isOtherPlayer = otherPlayerId != userPlayerId; + final playerId = otherPlayerId ?? userPlayerId; + final crossAxisCount = utilities.responsiveCondition( context, desktop: 2, @@ -61,23 +67,29 @@ class Loadouts extends HookConsumerWidget { // Methods final onCreate = useCallback( - () => Navigator.of(context).pushNamed( - screens.CreateLoadout.routeName, - arguments: - data_classes.CreateLoadoutScreenArguments(champion: champion), - ), - [], + () { + if (isOtherPlayer) return; + Navigator.of(context).pushNamed( + screens.CreateLoadout.routeName, + arguments: + data_classes.CreateLoadoutScreenArguments(champion: champion), + ); + }, + [isOtherPlayer], ); final onEdit = useCallback( - (models.Loadout loadout) => Navigator.of(context).pushNamed( - screens.CreateLoadout.routeName, - arguments: data_classes.CreateLoadoutScreenArguments( - champion: champion, - loadout: loadout, - ), - ), - [], + (models.Loadout loadout) { + if (isOtherPlayer) return; + Navigator.of(context).pushNamed( + screens.CreateLoadout.routeName, + arguments: data_classes.CreateLoadoutScreenArguments( + champion: champion, + loadout: loadout, + ), + ); + }, + [isOtherPlayer], ); final onRefresh = useCallback( @@ -94,42 +106,45 @@ class Loadouts extends HookConsumerWidget { ); return Scaffold( - floatingActionButton: SizedBox( - height: 40, - width: 90, - child: AnimatedSlide( - offset: - hideLoadoutFab.value ? const Offset(0, 2) : const Offset(0, 0), - duration: const Duration(milliseconds: 250), - child: FloatingActionButton( - onPressed: onCreate, - elevation: 4, - hoverElevation: 6, - focusElevation: 8, - backgroundColor: theme.themeMaterialColor, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon( - Icons.add, - size: 18, - color: Colors.white, - ), - const SizedBox(width: 2), - Text( - 'Create', - style: textTheme.bodyText2?.copyWith( - fontSize: 14, - color: Colors.white, + floatingActionButton: isOtherPlayer + ? null + : SizedBox( + height: 40, + width: 90, + child: AnimatedSlide( + offset: hideLoadoutFab.value + ? const Offset(0, 2) + : const Offset(0, 0), + duration: const Duration(milliseconds: 250), + child: FloatingActionButton( + onPressed: onCreate, + elevation: 4, + hoverElevation: 6, + focusElevation: 8, + backgroundColor: theme.themeMaterialColor, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon( + Icons.add, + size: 18, + color: Colors.white, + ), + const SizedBox(width: 2), + Text( + 'Create', + style: textTheme.bodyText2?.copyWith( + fontSize: 14, + color: Colors.white, + ), + ), + const SizedBox(width: 10), + ], ), + isExtended: true, ), - const SizedBox(width: 10), - ], + ), ), - isExtended: true, - ), - ), - ), body: widgets.Refresh( edgeOffset: utilities.getTopEdgeOffset(context), onRefresh: onRefresh, @@ -142,9 +157,11 @@ class Loadouts extends HookConsumerWidget { pinned: constants.isWeb, title: Column( children: [ - const Text('Loadouts'), + const Text('Your Loadouts'), Text( - champion.name, + isOtherPlayer + ? '${otherPlayer!.name} - ${champion.name}' + : champion.name, style: const TextStyle(fontSize: 12), ), ], diff --git a/lib/screens/player_champions/player_champions.dart b/lib/screens/player_champions/player_champions.dart index bbf37316..4f5bae74 100644 --- a/lib/screens/player_champions/player_champions.dart +++ b/lib/screens/player_champions/player_champions.dart @@ -1,7 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:paladinsedge/data_classes/index.dart' as data_classes; +import 'package:paladinsedge/models/index.dart' as models; import 'package:paladinsedge/providers/index.dart' as providers; +import 'package:paladinsedge/screens/index.dart' as screens; import 'package:paladinsedge/screens/player_champions/player_champions_data_source.dart'; import 'package:paladinsedge/widgets/index.dart' as widgets; import 'package:syncfusion_flutter_datagrid/datagrid.dart'; @@ -14,6 +17,7 @@ class PlayerChampions extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { // Providers + final player = ref.watch(providers.players.select((_) => _.playerData)); final playerChampions = ref.watch( providers.champions.select((_) => _.playerChampions), ); @@ -28,12 +32,28 @@ class PlayerChampions extends HookConsumerWidget { final _playerChampionsDataSource = useState(null); + // Methods + final onLoadoutPress = useCallback( + (models.Champion champion) { + Navigator.of(context).pushNamed( + screens.Loadouts.routeName, + arguments: data_classes.LoadoutScreenArguments( + champion: champion, + player: player, + ), + ); + }, + [player], + ); + // Effects useEffect( () { - if (playerChampions == null) return null; + if (player == null || playerChampions == null) return null; _playerChampionsDataSource.value = PlayerChampionsDataSource( + player: player, + onLoadoutPress: onLoadoutPress, champions: champions, playerChampions: playerChampions, ); @@ -45,7 +65,16 @@ class PlayerChampions extends HookConsumerWidget { return Scaffold( appBar: AppBar( - title: const Text('Player Champions'), + title: Column( + children: [ + const Text('Player Champions'), + if (player != null) + Text( + player.name, + style: const TextStyle(fontSize: 12), + ), + ], + ), ), body: _playerChampionsDataSource.value == null ? const Center( @@ -103,6 +132,7 @@ class PlayerChampions extends HookConsumerWidget { ), GridColumn( columnName: 'Play Time', + width: 140, autoFitPadding: const EdgeInsets.symmetric(horizontal: 10), label: Center( child: Text('Play Time', style: headerTextStyle), @@ -120,6 +150,14 @@ class PlayerChampions extends HookConsumerWidget { child: Text('Last Played', style: headerTextStyle), ), ), + GridColumn( + columnName: 'Loadouts', + allowSorting: false, + width: 160, + label: Center( + child: Text('Loadouts', style: headerTextStyle), + ), + ), ], ), ); diff --git a/lib/screens/player_champions/player_champions_data_source.dart b/lib/screens/player_champions/player_champions_data_source.dart index 8a6f46e7..b8d1a6d6 100644 --- a/lib/screens/player_champions/player_champions_data_source.dart +++ b/lib/screens/player_champions/player_champions_data_source.dart @@ -1,19 +1,27 @@ import 'package:dartx/dartx.dart'; import 'package:duration/duration.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'package:paladinsedge/data_classes/index.dart' as data_classes; import 'package:paladinsedge/models/index.dart' as models; +import 'package:paladinsedge/theme/index.dart' as theme; import 'package:paladinsedge/utilities/index.dart' as utilities; import 'package:paladinsedge/widgets/index.dart' as widgets; import 'package:syncfusion_flutter_datagrid/datagrid.dart'; +import 'package:touchable_opacity/touchable_opacity.dart'; class PlayerChampionsDataSource extends DataGridSource { + final models.Player player; + final void Function(models.Champion) onLoadoutPress; + final fontFamily = theme.Fonts.primaryAccent; List _playerChampions = []; @override List get rows => _playerChampions; PlayerChampionsDataSource({ + required this.player, + required this.onLoadoutPress, required List playerChampions, required List champions, }) { @@ -42,6 +50,7 @@ class PlayerChampionsDataSource extends DataGridSource { iconUrl: champion.iconUrl, sortedIndex: championIndex, iconBlurHash: champion.iconBlurHash, + name: champion.name, ), ), DataGridCell(columnName: 'Matches', value: matches), @@ -52,28 +61,39 @@ class PlayerChampionsDataSource extends DataGridSource { DataGridCell(columnName: 'Play Time', value: playTime), DataGridCell(columnName: 'Level', value: level), DataGridCell(columnName: 'Last Played', value: lastPlayed), + DataGridCell(columnName: 'Loadout', value: champion), ], ); }, ).toList(); } - TextStyle getWinRateStyle(double winRate) { - if (winRate > 60) { - return const TextStyle( + @override + DataGridRowAdapter? buildRow(DataGridRow row) { + return DataGridRowAdapter( + cells: row.getCells().map(_getCellWidget).toList(), + ); + } + + TextStyle _getKDAStyle(double kda) { + if (kda > 3.8) { + return TextStyle( + fontFamily: fontFamily, color: Colors.green, fontWeight: FontWeight.bold, fontSize: 16, ); } - if (winRate > 55) { - return const TextStyle( + if (kda > 3) { + return TextStyle( + fontFamily: fontFamily, color: Colors.orange, fontWeight: FontWeight.bold, ); } - if (winRate < 42) { - return const TextStyle( + if (kda < 1) { + return TextStyle( + fontFamily: fontFamily, color: Colors.red, fontSize: 15, ); @@ -82,22 +102,25 @@ class PlayerChampionsDataSource extends DataGridSource { return const TextStyle(fontSize: 14); } - TextStyle getKDAStyle(double kda) { - if (kda > 3.8) { - return const TextStyle( + TextStyle _getWinRateStyle(double winRate) { + if (winRate > 60) { + return TextStyle( + fontFamily: fontFamily, color: Colors.green, fontWeight: FontWeight.bold, fontSize: 16, ); } - if (kda > 3) { - return const TextStyle( + if (winRate > 55) { + return TextStyle( + fontFamily: fontFamily, color: Colors.orange, fontWeight: FontWeight.bold, ); } - if (kda < 1) { - return const TextStyle( + if (winRate < 42) { + return TextStyle( + fontFamily: fontFamily, color: Colors.red, fontSize: 15, ); @@ -106,53 +129,153 @@ class PlayerChampionsDataSource extends DataGridSource { return const TextStyle(fontSize: 14); } + Widget _getChampCellWidget(DataGridCell dataGridCell) { + final sortedData = + dataGridCell.value as data_classes.PlayerChampionsSortData; + + return Center( + child: widgets.ElevatedAvatar( + imageUrl: sortedData.iconUrl, + imageBlurHash: sortedData.iconBlurHash, + size: 22, + ), + ); + } + + Widget _getMatchesCellWidget(DataGridCell dataGridCell) { + return Center( + child: Text( + dataGridCell.value.toString(), + style: TextStyle(fontFamily: fontFamily), + ), + ); + } + + Widget _getKillsCellWidget(DataGridCell dataGridCell) { + return Center( + child: Text( + dataGridCell.value.toString(), + style: TextStyle(fontFamily: fontFamily), + ), + ); + } + + Widget _getDeathsCellWidget(DataGridCell dataGridCell) { + return Center( + child: Text( + dataGridCell.value.toString(), + style: TextStyle(fontFamily: fontFamily), + ), + ); + } + + Widget _getKDACellWidget(DataGridCell dataGridCell) { + return Center( + child: Text( + (dataGridCell.value as double).toStringAsPrecision(3), + style: _getKDAStyle(dataGridCell.value as double), + ), + ); + } + + Widget _getWinRateCellWidget(DataGridCell dataGridCell) { + return Center( + child: Text( + '${dataGridCell.value.toStringAsPrecision(3)}%', + style: _getWinRateStyle(dataGridCell.value as double), + ), + ); + } + + Widget _getPlayTimeCellWidget(DataGridCell dataGridCell) { + final playTime = Duration(minutes: dataGridCell.value as int); + final humanizedTime = printDuration( + playTime, + abbreviated: true, + upperTersity: DurationTersity.day, + ); + + return Center( + child: Text( + humanizedTime, + style: TextStyle(fontFamily: fontFamily), + ), + ); + } + + Widget _getLevelCellWidget(DataGridCell dataGridCell) { + return Center( + child: Text( + dataGridCell.value.toString(), + style: TextStyle(fontFamily: fontFamily), + ), + ); + } + + Widget _getLastPlayedCellWidget(DataGridCell dataGridCell) { + return Center( + child: Text( + utilities.getLastPlayedTime( + dataGridCell.value as DateTime, + shortFormat: true, + ), + style: TextStyle(fontFamily: fontFamily), + ), + ); + } + + Widget _getLoadoutCellWidget(DataGridCell dataGridCell) { + final champion = dataGridCell.value as models.Champion; + + return TouchableOpacity( + onTap: () => onLoadoutPress(champion), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "View loadouts", + style: TextStyle( + color: theme.themeMaterialColor, + fontFamily: fontFamily, + decoration: TextDecoration.underline, + fontSize: 16, + ), + ), + const SizedBox(width: 5), + const Icon( + FeatherIcons.arrowRight, + color: theme.themeMaterialColor, + size: 16, + ), + ], + ), + ); + } + // ignore: long-method - Widget getCellWidget(DataGridCell dataGridCell) { + Widget _getCellWidget(DataGridCell dataGridCell) { switch (dataGridCell.columnName) { case 'Champ': - final sortedData = - dataGridCell.value as data_classes.PlayerChampionsSortData; - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - widgets.ElevatedAvatar( - imageUrl: sortedData.iconUrl, - imageBlurHash: sortedData.iconBlurHash, - size: 22, - ), - ], - ); + return _getChampCellWidget(dataGridCell); + case 'Matches': + return _getMatchesCellWidget(dataGridCell); + case 'Kills': + return _getKillsCellWidget(dataGridCell); + case 'Deaths': + return _getDeathsCellWidget(dataGridCell); case 'KDA': - return Center( - child: Text( - dataGridCell.value.toStringAsPrecision(3) as String, - style: getKDAStyle(dataGridCell.value as double), - ), - ); + return _getKDACellWidget(dataGridCell); case 'Win Rate': - return Center( - child: Text( - '${dataGridCell.value.toStringAsPrecision(3)}%', - style: getWinRateStyle(dataGridCell.value as double), - ), - ); + return _getWinRateCellWidget(dataGridCell); case 'Play Time': - final playTime = Duration(minutes: dataGridCell.value as int); - final humanizedTime = printDuration( - playTime, - abbreviated: true, - upperTersity: DurationTersity.day, - ); - return Center(child: Text(humanizedTime)); + return _getPlayTimeCellWidget(dataGridCell); + case 'Level': + return _getLevelCellWidget(dataGridCell); case 'Last Played': - return Center( - child: Text( - utilities.getLastPlayedTime( - dataGridCell.value as DateTime, - shortFormat: true, - ), - ), - ); + return _getLastPlayedCellWidget(dataGridCell); + case 'Loadout': + return _getLoadoutCellWidget(dataGridCell); } return Align( @@ -163,11 +286,4 @@ class PlayerChampionsDataSource extends DataGridSource { ), ); } - - @override - DataGridRowAdapter? buildRow(DataGridRow row) { - return DataGridRowAdapter( - cells: row.getCells().map(getCellWidget).toList(), - ); - } } diff --git a/lib/theme/fonts.dart b/lib/theme/fonts.dart new file mode 100644 index 00000000..76dc6698 --- /dev/null +++ b/lib/theme/fonts.dart @@ -0,0 +1,8 @@ +import "package:google_fonts/google_fonts.dart"; + +abstract class Fonts { + static final primary = GoogleFonts.poppins().fontFamily; + static final primaryAccent = GoogleFonts.manrope().fontFamily; + static final secondary = GoogleFonts.raleway().fontFamily; + static final secondaryAccent = GoogleFonts.montserrat().fontFamily; +} diff --git a/lib/theme/index.dart b/lib/theme/index.dart index 1db82328..a59ae996 100644 --- a/lib/theme/index.dart +++ b/lib/theme/index.dart @@ -1,2 +1,3 @@ export './colors.dart'; +export './fonts.dart'; export './theme.dart'; diff --git a/lib/theme/theme.dart b/lib/theme/theme.dart index c31c6de1..9b1a5b6e 100644 --- a/lib/theme/theme.dart +++ b/lib/theme/theme.dart @@ -1,7 +1,7 @@ import "package:flutter/material.dart"; import 'package:flutter/services.dart'; -import "package:google_fonts/google_fonts.dart"; import 'package:paladinsedge/theme/colors.dart'; +import 'package:paladinsedge/theme/fonts.dart'; /// ThemeData for light theme final lightTheme = ThemeData( @@ -23,12 +23,12 @@ final lightTheme = ThemeData( titleTextStyle: TextStyle( color: Colors.white, fontSize: 20, - fontFamily: GoogleFonts.poppins().fontFamily, + fontFamily: Fonts.primary, ), toolbarTextStyle: TextStyle( color: Colors.white, fontSize: 20, - fontFamily: GoogleFonts.raleway().fontFamily, + fontFamily: Fonts.secondary, fontWeight: FontWeight.bold, ), ), @@ -50,34 +50,34 @@ final lightTheme = ThemeData( cursorColor: themeMaterialColor.shade300, ), brightness: Brightness.light, - fontFamily: GoogleFonts.manrope().fontFamily, + fontFamily: Fonts.primaryAccent, textTheme: TextTheme( headline1: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, color: themeMaterialColor, fontWeight: FontWeight.bold, ), headline2: TextStyle( - fontFamily: GoogleFonts.poppins().fontFamily, + fontFamily: Fonts.primary, color: themeMaterialColor, fontWeight: FontWeight.bold, ), headline3: TextStyle( - fontFamily: GoogleFonts.poppins().fontFamily, + fontFamily: Fonts.primary, color: Colors.black, fontWeight: FontWeight.bold, fontSize: 18, ), bodyText1: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, color: Colors.black54, ), bodyText2: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, color: Colors.black, ), subtitle1: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, fontSize: 12, ), ), @@ -95,13 +95,13 @@ final lightTheme = ThemeData( ), tabBarTheme: TabBarTheme( labelStyle: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, fontWeight: FontWeight.bold, fontSize: 14, ), labelColor: themeMaterialColor, unselectedLabelStyle: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, fontSize: 14, ), unselectedLabelColor: Colors.grey, @@ -111,12 +111,12 @@ final lightTheme = ThemeData( headingRowColor: MaterialStateProperty.all(themeMaterialColor.shade100), dataTextStyle: TextStyle( fontSize: 14, - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, ), headingTextStyle: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, - fontFamily: GoogleFonts.poppins().fontFamily, + fontFamily: Fonts.primary, ), ), bottomSheetTheme: BottomSheetThemeData( @@ -157,12 +157,12 @@ final darkTheme = ThemeData( titleTextStyle: TextStyle( color: Colors.white, fontSize: 20, - fontFamily: GoogleFonts.poppins().fontFamily, + fontFamily: Fonts.primary, ), toolbarTextStyle: TextStyle( color: Colors.white, fontSize: 20, - fontFamily: GoogleFonts.raleway().fontFamily, + fontFamily: Fonts.secondary, fontWeight: FontWeight.bold, ), ), @@ -183,34 +183,34 @@ final darkTheme = ThemeData( cursorColor: darkThemeMaterialColor.shade300, ), brightness: Brightness.dark, - fontFamily: GoogleFonts.manrope().fontFamily, + fontFamily: Fonts.primaryAccent, textTheme: TextTheme( headline1: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, color: Colors.white, fontWeight: FontWeight.bold, ), headline2: TextStyle( - fontFamily: GoogleFonts.poppins().fontFamily, + fontFamily: Fonts.primary, color: Colors.white, fontWeight: FontWeight.bold, ), headline3: TextStyle( - fontFamily: GoogleFonts.poppins().fontFamily, + fontFamily: Fonts.primary, color: Colors.white, fontWeight: FontWeight.bold, fontSize: 18, ), bodyText1: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, color: Colors.white54, ), bodyText2: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, color: Colors.white, ), subtitle1: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, fontSize: 12, ), ), @@ -228,12 +228,12 @@ final darkTheme = ThemeData( ), tabBarTheme: TabBarTheme( labelStyle: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, fontSize: 14, ), labelColor: Colors.white, unselectedLabelStyle: TextStyle( - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, fontSize: 14, ), unselectedLabelColor: Colors.white60, @@ -243,12 +243,12 @@ final darkTheme = ThemeData( headingRowColor: MaterialStateProperty.all(darkThemeMaterialColor.shade100), dataTextStyle: TextStyle( fontSize: 14, - fontFamily: GoogleFonts.montserrat().fontFamily, + fontFamily: Fonts.secondaryAccent, ), headingTextStyle: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, - fontFamily: GoogleFonts.poppins().fontFamily, + fontFamily: Fonts.primary, ), ), bottomSheetTheme: BottomSheetThemeData( diff --git a/lib/widgets/elevated_avatar.dart b/lib/widgets/elevated_avatar.dart index 7709f320..c017f614 100644 --- a/lib/widgets/elevated_avatar.dart +++ b/lib/widgets/elevated_avatar.dart @@ -25,16 +25,16 @@ class ElevatedAvatar extends StatelessWidget { Widget build(BuildContext context) { final borderRadius = this.borderRadius ?? size / 2; - return Material( - color: Theme.of(context).cardTheme.color, - clipBehavior: Clip.antiAlias, - elevation: elevation ?? 5, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(borderRadius), - ), - child: SizedBox( - height: size * 2, - width: size * 2, + return SizedBox( + height: size * 2, + width: size * 2, + child: Material( + color: Theme.of(context).cardTheme.color, + clipBehavior: Clip.antiAlias, + elevation: elevation ?? 5, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(borderRadius), + ), child: widgets.FastImage( imageUrl: imageUrl, imageBlurHash: imageBlurHash, diff --git a/lib/widgets/fast_image.dart b/lib/widgets/fast_image.dart index 807b4379..371f17ef 100644 --- a/lib/widgets/fast_image.dart +++ b/lib/widgets/fast_image.dart @@ -26,8 +26,8 @@ class FastImage extends StatelessWidget { borderRadius: borderRadius, child: CachedNetworkImage( placeholderFadeInDuration: const Duration(milliseconds: 250), - fadeInDuration: const Duration(milliseconds: 250), - fadeOutDuration: const Duration(milliseconds: 250), + fadeInDuration: Duration.zero, + fadeOutDuration: Duration.zero, errorWidget: (_, __, ___) => imageBlurHash != null ? SizedBox( height: height,