Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@ class App extends StatelessWidget {
Widget build(BuildContext context) => MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: supportedLocales,
onGenerateTitle: (context) => 'MusicPod',
onGenerateTitle: (context) => 'Pulse',
debugShowCheckedModeBanner: false,
theme: yaruLight,
darkTheme: yaruDark.copyWith(
tabBarTheme: TabBarTheme.of(context).copyWith(
labelColor: Colors.white,
unselectedLabelColor: Colors.white.withValues(
alpha: 0.8,
),
),
),
darkTheme: yaruDark,
home: const _StartPage(),
scrollBehavior: const MaterialScrollBehavior().copyWith(
dragDevices: {
Expand Down
12 changes: 11 additions & 1 deletion lib/weather/view/weather_page.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_weather_bg_null_safety/utils/weather_type.dart';
import 'package:watch_it/watch_it.dart';
import 'package:yaru/yaru.dart';

import '../../constants.dart';
import '../../app/app_model.dart';
import '../../app/side_bar.dart';
import '../../constants.dart';
import '../../l10n/l10n.dart';
import '../weather_data_x.dart';
import '../weather_model.dart';
import 'daily_bar_chart.dart';
import 'hourly_line_chart.dart';

Expand All @@ -20,7 +23,12 @@ class WeatherPage extends StatelessWidget with WatchItMixin {
Widget build(BuildContext context) {
final appModel = watchIt<AppModel>();
final showToday = appModel.tabIndex == 0;
final weatherType =
watchPropertyValue((WeatherModel m) => m.data?.weatherType);

final labelColor = weatherType == null
? null
: contrastColor(WeatherUtil.getColor(weatherType).first);
return DefaultTabController(
initialIndex: appModel.tabIndex,
length: 2,
Expand All @@ -46,6 +54,8 @@ class WeatherPage extends StatelessWidget with WatchItMixin {
title: SizedBox(
width: kPaneWidth,
child: YaruTabBar(
labelColor: labelColor,
unselectedLabelColor: labelColor?.withValues(alpha: 0.8),
onTap: (v) => appModel.tabIndex = v,
tabs: [
Tab(text: context.l10n.hourly),
Expand Down
9 changes: 6 additions & 3 deletions lib/weather/weather_data_x.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ extension WeatherDataX on WeatherData {
'Drizzle' => WeatherType.lightRainy,
'Rain' => WeatherType.middleRainy,
'Snow' => WeatherType.heavySnow,
'Clear' => night ? WeatherType.sunnyNight : WeatherType.sunny,
'Sunny' => night ? WeatherType.sunnyNight : WeatherType.sunny,
'Clear' ||
'Sunny' =>
night ? WeatherType.sunnyNight : WeatherType.sunny,
'Wind' => night ? WeatherType.dusty : WeatherType.dusty,
'Mist' => WeatherType.foggy,
_ => WeatherType.thunder
'Fog' => WeatherType.foggy,
'Thunderstorm' || 'Thunder' || 'Lightning' => WeatherType.thunder,
_ => WeatherType.sunny
}
};
}
Expand Down
9 changes: 5 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1038,10 +1038,11 @@ packages:
yaru:
dependency: "direct main"
description:
name: yaru
sha256: f149399d81ecd3d20bfcc79afd5ddd9bcd7e4c901d5e602a8577fe59c71c8617
url: "https://pub.dev"
source: hosted
path: "."
ref: e4be44ca80d4535eacb85a8c7fb422fa9c15d43c
resolved-ref: e4be44ca80d4535eacb85a8c7fb422fa9c15d43c
url: "https://github.com/ubuntu/yaru.dart"
source: git
version: "7.0.0"
yaru_window:
dependency: transitive
Expand Down
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ dependencies:
shared_preferences: ^2.5.1
watch_it: ^1.6.2
xdg_directories: ^1.0.4
yaru: ^7.0.0
yaru:
git:
url: https://github.com/ubuntu/yaru.dart
ref: e4be44ca80d4535eacb85a8c7fb422fa9c15d43c

dev_dependencies:
build_runner: ^2.4.8
Expand Down