Skip to content

Commit 585fc37

Browse files
committed
fix: update pubspec.yaml to include package_info_plus and display app version on HomeScreen
1 parent 62f2f2b commit 585fc37

4 files changed

Lines changed: 95 additions & 4 deletions

File tree

.github/workflows/build.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ jobs:
5959
cache: true
6060
- run: flutter --version
6161

62+
- name: Update pubspec.yaml version
63+
run: |
64+
# Update the version in pubspec.yaml with the semantic version
65+
sed -i "s/^version: .*/version: ${{ needs.version.outputs.version }}+${{ github.run_number }}/g" pubspec.yaml
66+
echo "Updated pubspec.yaml version to: ${{ needs.version.outputs.version }}+${{ github.run_number }}"
67+
68+
# Verify the change
69+
grep "^version:" pubspec.yaml
70+
6271
- name: Install dependencies
6372
run: flutter pub get
6473

@@ -81,7 +90,13 @@ jobs:
8190
with:
8291
tag_name: v${{ needs.version.outputs.version }}
8392
name: Release v${{ needs.version.outputs.version }}
84-
body: ${{ steps.release-notes.outputs.body }}
93+
body: |
94+
## What's Changed
95+
96+
Build artifacts for version ${{ needs.version.outputs.version }}
97+
98+
- App version updated to: ${{ needs.version.outputs.version }}+${{ github.run_number }}
99+
- Built from commit: ${{ github.sha }}
85100
draft: false
86101
prerelease: true
87102
generate_release_notes: true

lib/features/presentation/home_screen.dart

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,67 @@ import 'package:flutter/material.dart';
22
import 'package:interacting_tom/features/presentation/animation_screen.dart';
33
import 'package:interacting_tom/features/presentation/speech_to_text.dart';
44
import 'package:interacting_tom/features/presentation/text_to_speech_cloud.dart';
5+
import 'package:package_info_plus/package_info_plus.dart';
56

6-
class HomeScreen extends StatelessWidget {
7+
class HomeScreen extends StatefulWidget {
78
const HomeScreen({super.key});
89

10+
@override
11+
State<HomeScreen> createState() => _HomeScreenState();
12+
}
13+
14+
class _HomeScreenState extends State<HomeScreen> {
15+
String _version = '';
16+
17+
@override
18+
void initState() {
19+
super.initState();
20+
_getAppVersion();
21+
}
22+
23+
Future<void> _getAppVersion() async {
24+
try {
25+
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
26+
setState(() {
27+
_version = 'v${packageInfo.version}+${packageInfo.buildNumber}';
28+
});
29+
} catch (e) {
30+
setState(() {
31+
_version = 'v1.0.0+1'; // fallback version
32+
});
33+
}
34+
}
35+
936
@override
1037
Widget build(BuildContext context) {
1138
print('home screen built');
1239
return Scaffold(
13-
body: TextToSpeechCloud(
14-
child: AnimationScreen(),
40+
body: Stack(
41+
children: [
42+
TextToSpeechCloud(
43+
child: AnimationScreen(),
44+
),
45+
// Version display in bottom-left corner
46+
Positioned(
47+
bottom: 16,
48+
left: 16,
49+
child: Container(
50+
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
51+
decoration: BoxDecoration(
52+
color: Colors.black.withOpacity(0.3),
53+
borderRadius: BorderRadius.circular(12),
54+
),
55+
child: Text(
56+
_version,
57+
style: const TextStyle(
58+
color: Colors.white70,
59+
fontSize: 12,
60+
fontWeight: FontWeight.w500,
61+
),
62+
),
63+
),
64+
),
65+
],
1566
),
1667
floatingActionButton: Column(
1768
mainAxisSize: MainAxisSize.min,

pubspec.lock

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,22 @@ packages:
544544
url: "https://pub.dev"
545545
source: hosted
546546
version: "2.2.0"
547+
package_info_plus:
548+
dependency: "direct main"
549+
description:
550+
name: package_info_plus
551+
sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d
552+
url: "https://pub.dev"
553+
source: hosted
554+
version: "9.0.0"
555+
package_info_plus_platform_interface:
556+
dependency: transitive
557+
description:
558+
name: package_info_plus_platform_interface
559+
sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086"
560+
url: "https://pub.dev"
561+
source: hosted
562+
version: "3.2.1"
547563
path:
548564
dependency: transitive
549565
description:
@@ -1013,6 +1029,14 @@ packages:
10131029
url: "https://pub.dev"
10141030
source: hosted
10151031
version: "3.0.3"
1032+
win32:
1033+
dependency: transitive
1034+
description:
1035+
name: win32
1036+
sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e
1037+
url: "https://pub.dev"
1038+
source: hosted
1039+
version: "5.15.0"
10161040
xdg_directories:
10171041
dependency: transitive
10181042
description:

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dependencies:
4747
collection: ^1.17.1
4848
just_audio: ^0.9.34
4949
http: ^1.1.0
50+
package_info_plus: ^9.0.0
5051

5152
dev_dependencies:
5253
build_runner: ^2.4.8

0 commit comments

Comments
 (0)