Skip to content

Commit

Permalink
Merge pull request #16 from domesticmouse/flutter-3.27-beta
Browse files Browse the repository at this point in the history
Fixes for Flutter 3.27
  • Loading branch information
domesticmouse authored Dec 11, 2024
2 parents 3c02eb0 + 94118ab commit e3d6203
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.6

* Update for Flutter 3.27.0

## 0.6.5

* implemented #12: would like some hover icons for copy+edit on web and desktop
Expand Down
6 changes: 3 additions & 3 deletions example/lib/custom_styles/custom_styles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class _ChatPageState extends State<ChatPage>
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
hintText: 'good evening...',
hintStyle:
halloweenTextStyle.copyWith(color: Colors.orange.withOpacity(.5)),
halloweenTextStyle.copyWith(color: Colors.orange.withAlpha(128)),
),
userMessageStyle: UserMessageStyle(
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
Expand All @@ -177,7 +177,7 @@ class _ChatPageState extends State<ChatPage>
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
color: Colors.grey.withAlpha(128),
blurRadius: 10,
spreadRadius: 2,
),
Expand Down Expand Up @@ -215,7 +215,7 @@ class _ChatPageState extends State<ChatPage>
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
color: Colors.black.withAlpha(76),
blurRadius: 8,
offset: Offset(2, 2),
),
Expand Down
10 changes: 4 additions & 6 deletions example/lib/dark_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,10 @@ SuggestionStyle _darkSuggestionStyle() {

const Color _greyBackground = Color(0xFF535353);

Color _invertColor(Color? color) => Color.fromARGB(
color!.alpha,
255 - color.red,
255 - color.green,
255 - color.blue,
);
Color? _invertColor(Color? color) => color != null
? Color.from(
alpha: color.a, red: 1 - color.r, green: 1 - color.g, blue: 1 - color.b)
: null;

Decoration _invertDecoration(Decoration? decoration) => switch (decoration!) {
final BoxDecoration d => d.copyWith(color: _invertColor(d.color)),
Expand Down
6 changes: 3 additions & 3 deletions example/lib/demo/demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class _ChatPageState extends State<ChatPage>
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
hintText: 'good evening...',
hintStyle:
halloweenTextStyle.copyWith(color: Colors.orange.withOpacity(.5)),
halloweenTextStyle.copyWith(color: Colors.orange.withAlpha(128)),
),
userMessageStyle: UserMessageStyle(
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
Expand All @@ -265,7 +265,7 @@ class _ChatPageState extends State<ChatPage>
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
color: Colors.grey.withAlpha(128),
blurRadius: 10,
spreadRadius: 2,
),
Expand Down Expand Up @@ -303,7 +303,7 @@ class _ChatPageState extends State<ChatPage>
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
color: Colors.black.withAlpha(76),
blurRadius: 8,
offset: Offset(2, 2),
),
Expand Down
6 changes: 3 additions & 3 deletions example/lib/styles/styles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class _ChatPageState extends State<ChatPage>
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
hintText: 'good evening...',
hintStyle: halloweenTextStyle.copyWith(
color: Colors.orange.withOpacity(.5)),
color: Colors.orange.withAlpha(128)),
),
userMessageStyle: UserMessageStyle(
textStyle: halloweenTextStyle.copyWith(color: Colors.black),
Expand All @@ -149,7 +149,7 @@ class _ChatPageState extends State<ChatPage>
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
color: Colors.grey.withAlpha(128),
blurRadius: 10,
spreadRadius: 2,
),
Expand Down Expand Up @@ -187,7 +187,7 @@ class _ChatPageState extends State<ChatPage>
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
color: Colors.black.withAlpha(76),
blurRadius: 8,
offset: Offset(2, 2),
),
Expand Down
3 changes: 2 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: flutter_ai_toolkit_example
description: "Sample apps showing off various features of the Flutter AI Toolkit."
publish_to: 'none'
version: 0.6.5
version: 0.6.6

environment:
sdk: ^3.4.4
flutter: '>=3.27.0-0'

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/styles/toolkit_text_styles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ abstract final class ToolkitTextStyles {
///
/// Used for the text of tooltips.
static final TextStyle tooltip = GoogleFonts.roboto(
color: ToolkitColors.tooltipText.withOpacity(0.9),
color: ToolkitColors.tooltipText.withAlpha(230),
fontSize: 14,
fontWeight: FontWeight.w400,
);
Expand Down
10 changes: 4 additions & 6 deletions lib/src/utility.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ Future<void> copyToClipboard(BuildContext context, String text) async {
/// * [color]: The [Color] to be inverted. This parameter must not be null.
///
/// Returns: A new [Color] object with the inverted RGB values.
Color invertColor(Color? color) => Color.fromARGB(
color!.alpha,
255 - color.red,
255 - color.green,
255 - color.blue,
);
Color? invertColor(Color? color) => color != null
? Color.from(
alpha: color.a, red: 1 - color.r, green: 1 - color.g, blue: 1 - color.b)
: null;
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: flutter_ai_toolkit
description: "A set of AI chat-related widgets for your Flutter app targeting mobile, desktop and web."
version: 0.6.5
version: 0.6.6
homepage: https://github.com/flutter/ai

environment:
sdk: '>=3.4.0 <4.0.0'
flutter: ">=1.17.0"
flutter: '>=3.27.0-0'

dependencies:
cross_file: ^0.3.4+2
Expand Down

0 comments on commit e3d6203

Please sign in to comment.