Skip to content

Commit e3d6203

Browse files
Merge pull request #16 from domesticmouse/flutter-3.27-beta
Fixes for Flutter 3.27
2 parents 3c02eb0 + 94118ab commit e3d6203

File tree

9 files changed

+26
-25
lines changed

9 files changed

+26
-25
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.6.6
2+
3+
* Update for Flutter 3.27.0
4+
15
## 0.6.5
26

37
* implemented #12: would like some hover icons for copy+edit on web and desktop

example/lib/custom_styles/custom_styles.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class _ChatPageState extends State<ChatPage>
160160
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
161161
hintText: 'good evening...',
162162
hintStyle:
163-
halloweenTextStyle.copyWith(color: Colors.orange.withOpacity(.5)),
163+
halloweenTextStyle.copyWith(color: Colors.orange.withAlpha(128)),
164164
),
165165
userMessageStyle: UserMessageStyle(
166166
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
@@ -177,7 +177,7 @@ class _ChatPageState extends State<ChatPage>
177177
borderRadius: BorderRadius.circular(20),
178178
boxShadow: [
179179
BoxShadow(
180-
color: Colors.grey.withOpacity(0.5),
180+
color: Colors.grey.withAlpha(128),
181181
blurRadius: 10,
182182
spreadRadius: 2,
183183
),
@@ -215,7 +215,7 @@ class _ChatPageState extends State<ChatPage>
215215
),
216216
boxShadow: [
217217
BoxShadow(
218-
color: Colors.black.withOpacity(0.3),
218+
color: Colors.black.withAlpha(76),
219219
blurRadius: 8,
220220
offset: Offset(2, 2),
221221
),

example/lib/dark_style.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,10 @@ SuggestionStyle _darkSuggestionStyle() {
134134

135135
const Color _greyBackground = Color(0xFF535353);
136136

137-
Color _invertColor(Color? color) => Color.fromARGB(
138-
color!.alpha,
139-
255 - color.red,
140-
255 - color.green,
141-
255 - color.blue,
142-
);
137+
Color? _invertColor(Color? color) => color != null
138+
? Color.from(
139+
alpha: color.a, red: 1 - color.r, green: 1 - color.g, blue: 1 - color.b)
140+
: null;
143141

144142
Decoration _invertDecoration(Decoration? decoration) => switch (decoration!) {
145143
final BoxDecoration d => d.copyWith(color: _invertColor(d.color)),

example/lib/demo/demo.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class _ChatPageState extends State<ChatPage>
248248
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
249249
hintText: 'good evening...',
250250
hintStyle:
251-
halloweenTextStyle.copyWith(color: Colors.orange.withOpacity(.5)),
251+
halloweenTextStyle.copyWith(color: Colors.orange.withAlpha(128)),
252252
),
253253
userMessageStyle: UserMessageStyle(
254254
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
@@ -265,7 +265,7 @@ class _ChatPageState extends State<ChatPage>
265265
borderRadius: BorderRadius.circular(20),
266266
boxShadow: [
267267
BoxShadow(
268-
color: Colors.grey.withOpacity(0.5),
268+
color: Colors.grey.withAlpha(128),
269269
blurRadius: 10,
270270
spreadRadius: 2,
271271
),
@@ -303,7 +303,7 @@ class _ChatPageState extends State<ChatPage>
303303
),
304304
boxShadow: [
305305
BoxShadow(
306-
color: Colors.black.withOpacity(0.3),
306+
color: Colors.black.withAlpha(76),
307307
blurRadius: 8,
308308
offset: Offset(2, 2),
309309
),

example/lib/styles/styles.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class _ChatPageState extends State<ChatPage>
132132
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
133133
hintText: 'good evening...',
134134
hintStyle: halloweenTextStyle.copyWith(
135-
color: Colors.orange.withOpacity(.5)),
135+
color: Colors.orange.withAlpha(128)),
136136
),
137137
userMessageStyle: UserMessageStyle(
138138
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
@@ -149,7 +149,7 @@ class _ChatPageState extends State<ChatPage>
149149
borderRadius: BorderRadius.circular(20),
150150
boxShadow: [
151151
BoxShadow(
152-
color: Colors.grey.withOpacity(0.5),
152+
color: Colors.grey.withAlpha(128),
153153
blurRadius: 10,
154154
spreadRadius: 2,
155155
),
@@ -187,7 +187,7 @@ class _ChatPageState extends State<ChatPage>
187187
),
188188
boxShadow: [
189189
BoxShadow(
190-
color: Colors.black.withOpacity(0.3),
190+
color: Colors.black.withAlpha(76),
191191
blurRadius: 8,
192192
offset: Offset(2, 2),
193193
),

example/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: flutter_ai_toolkit_example
22
description: "Sample apps showing off various features of the Flutter AI Toolkit."
33
publish_to: 'none'
4-
version: 0.6.5
4+
version: 0.6.6
55

66
environment:
77
sdk: ^3.4.4
8+
flutter: '>=3.27.0-0'
89

910
dependencies:
1011
flutter:

lib/src/styles/toolkit_text_styles.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ abstract final class ToolkitTextStyles {
6868
///
6969
/// Used for the text of tooltips.
7070
static final TextStyle tooltip = GoogleFonts.roboto(
71-
color: ToolkitColors.tooltipText.withOpacity(0.9),
71+
color: ToolkitColors.tooltipText.withAlpha(230),
7272
fontSize: 14,
7373
fontWeight: FontWeight.w400,
7474
);

lib/src/utility.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ Future<void> copyToClipboard(BuildContext context, String text) async {
6666
/// * [color]: The [Color] to be inverted. This parameter must not be null.
6767
///
6868
/// Returns: A new [Color] object with the inverted RGB values.
69-
Color invertColor(Color? color) => Color.fromARGB(
70-
color!.alpha,
71-
255 - color.red,
72-
255 - color.green,
73-
255 - color.blue,
74-
);
69+
Color? invertColor(Color? color) => color != null
70+
? Color.from(
71+
alpha: color.a, red: 1 - color.r, green: 1 - color.g, blue: 1 - color.b)
72+
: null;

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: flutter_ai_toolkit
22
description: "A set of AI chat-related widgets for your Flutter app targeting mobile, desktop and web."
3-
version: 0.6.5
3+
version: 0.6.6
44
homepage: https://github.com/flutter/ai
55

66
environment:
77
sdk: '>=3.4.0 <4.0.0'
8-
flutter: ">=1.17.0"
8+
flutter: '>=3.27.0-0'
99

1010
dependencies:
1111
cross_file: ^0.3.4+2

0 commit comments

Comments
 (0)