Skip to content

Commit

Permalink
Update deps and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Feb 28, 2024
1 parent a676fd1 commit 2b9f965
Show file tree
Hide file tree
Showing 7 changed files with 209 additions and 146 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
pull_request:
branches: [main]

env:
FLUTTER_VERSION: '3.16.x'

jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{env.FLUTTER_VERSION}}
- run: flutter pub get
- run: flutter analyze --fatal-infos

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{env.FLUTTER_VERSION}}
- run: flutter pub get
- run: dart format --set-exit-if-changed .

# test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: subosito/flutter-action@v2
# with:
# channel: 'stable'
# flutter-version: ${{env.FLUTTER_VERSION}}
# - run: flutter test

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{env.FLUTTER_VERSION}}
- run: sudo apt update
- run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip libunwind-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libmpv-dev
- run: flutter pub get
- run: flutter build linux -v
61 changes: 34 additions & 27 deletions lib/app/forecast_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import 'package:pulse/app/utils.dart';
import 'package:pulse/string_x.dart';
import 'package:pulse/weather_data_x.dart';

class ForecastTile extends StatelessWidget {
final WeatherData data;
class ForecastTile extends StatefulWidget {
final List<WeatherData> data;
final WeatherData selectedData;
final String? cityName;
final double fontSize;
final String? position;
Expand All @@ -20,7 +21,7 @@ class ForecastTile extends StatelessWidget {

const ForecastTile({
super.key,
required this.data,
required this.selectedData,
this.cityName,
this.fontSize = 20,
this.position,
Expand All @@ -30,8 +31,14 @@ class ForecastTile extends StatelessWidget {
required this.padding,
this.time,
this.borderRadius = const BorderRadius.all(Radius.circular(10)),
required this.data,
});

@override
State<ForecastTile> createState() => _ForecastTileState();
}

class _ForecastTileState extends State<ForecastTile> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
Expand All @@ -44,7 +51,7 @@ class ForecastTile extends StatelessWidget {
color: Colors.black.withOpacity(0.8),
offset: const Offset(0, 1),
blurRadius: 3,
)
),
],
);

Expand All @@ -53,60 +60,60 @@ class ForecastTile extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
data.currentTemperature,
widget.selectedData.currentTemperature,
style: style,
),
Text(
'Feels like: ${data.feelsLike}',
'Feels like: ${widget.selectedData.feelsLike}',
style: style,
),
Text(
'Wind: ${data.windSpeed}',
'Wind: ${widget.selectedData.windSpeed}',
style: style,
),
],
),
if (day != null)
if (widget.day != null)
Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
day!,
widget.day!,
style: style,
),
if (time != null)
if (widget.time != null)
Text(
time!,
widget.time!,
style: style,
),
],
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
getIcon(data, theme.colorScheme),
getIcon(widget.selectedData, theme.colorScheme),
const SizedBox(
width: 10,
),
Text(
data.longDescription.capitalize(),
widget.selectedData.longDescription.capitalize(),
textAlign: TextAlign.center,
style: style,
overflow: TextOverflow.ellipsis,
)
),
],
),
if (cityName != null)
if (widget.cityName != null)
Text(
cityName!,
widget.cityName!,
style: style,
)
else if (position != null)
else if (widget.position != null)
Text(
position ?? '',
widget.position ?? '',
style: style,
textAlign: TextAlign.center,
)
),
];

final banner = Card(
Expand All @@ -115,11 +122,11 @@ class ForecastTile extends StatelessWidget {
Opacity(
opacity: light ? 1 : 0.4,
child: ClipRRect(
borderRadius: borderRadius,
borderRadius: widget.borderRadius,
child: WeatherBg(
weatherType: getWeatherType(data),
width: width ?? double.infinity,
height: height ?? double.infinity,
weatherType: getWeatherType(widget.selectedData),
width: widget.width ?? double.infinity,
height: widget.height ?? double.infinity,
),
),
),
Expand All @@ -135,16 +142,16 @@ class ForecastTile extends StatelessWidget {
children: children,
),
),
)
),
],
),
);

return SizedBox(
width: width,
height: height,
width: widget.width,
height: widget.height,
child: Padding(
padding: padding,
padding: widget.padding,
child: banner,
),
);
Expand Down
12 changes: 6 additions & 6 deletions lib/app/today_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TodayTile extends StatelessWidget {
final String? time;

const TodayTile({
Key? key,
super.key,
required this.data,
this.cityName,
this.fontSize = 20,
Expand All @@ -28,7 +28,7 @@ class TodayTile extends StatelessWidget {
this.day,
required this.padding,
this.time,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand All @@ -42,7 +42,7 @@ class TodayTile extends StatelessWidget {
color: Colors.black.withOpacity(0.8),
offset: const Offset(0, 1),
blurRadius: 3,
)
),
],
);

Expand Down Expand Up @@ -91,7 +91,7 @@ class TodayTile extends StatelessWidget {
textAlign: TextAlign.center,
style: style,
overflow: TextOverflow.ellipsis,
)
),
],
),
if (cityName != null)
Expand All @@ -107,7 +107,7 @@ class TodayTile extends StatelessWidget {
style: style,
textAlign: TextAlign.center,
),
)
),
];

final banner = Card(
Expand All @@ -134,7 +134,7 @@ class TodayTile extends StatelessWidget {
runAlignment: WrapAlignment.center,
children: children,
),
)
),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/app/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Icon getIcon(
color: Colors.black.withOpacity(0.8),
offset: const Offset(0, 1),
blurRadius: 3,
)
),
];

switch (weatherData.shortDescription) {
Expand Down
12 changes: 7 additions & 5 deletions lib/app/weather_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class WeatherPage extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 20),
day: todayForecast.getDate(context),
time: todayForecast.getTime(context),
data: todayForecast,
selectedData: todayForecast,
data: const [],
fontSize: 15,
),
if (model.notTodayForeCast.isNotEmpty == true)
Expand All @@ -53,10 +54,11 @@ class WeatherPage extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 20),
day: model.notTodayForeCast[i].getDate(context),
time: model.notTodayForeCast[i].getTime(context),
data: model.notTodayForeCast[i],
selectedData: model.notTodayForeCast[i],
data: const [],
fontSize: 15,
// borderRadius: getBorderRadius(i, model.notTodayForeCast),
)
),
];
final scaffold = Scaffold(
backgroundColor: model.data == null
Expand Down Expand Up @@ -99,7 +101,7 @@ class WeatherPage extends StatelessWidget {
fontSize: 20,
cityName: model.cityName,
),
...foreCastTiles
...foreCastTiles,
],
);

Expand Down Expand Up @@ -127,7 +129,7 @@ class WeatherPage extends StatelessWidget {
child: ListView(
children: foreCastTiles,
),
)
),
],
),
);
Expand Down
Loading

0 comments on commit 2b9f965

Please sign in to comment.