Skip to content

Commit

Permalink
fix 3.27
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Dec 17, 2024
1 parent 3de69a3 commit e20e92c
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

> 目前开始逐步补全完善,主要提供一些有用或者有趣的例子,如果你也有好例子,欢迎提交 PR 。
>
> **运行须知:配置好Flutter开发环境(目前Flutter SDK 版本 *3.24* 以上版本)。**
> **运行须知:配置好Flutter开发环境(目前Flutter SDK 版本 *3.27* 以上版本)。**
>
> **[如果克隆太慢或者图片看不到,可尝试从码云地址下载](https://gitee.com/CarGuo/GSYFlutterDemo)**
Expand Down
3 changes: 3 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ class MyHomePageState extends State<MyHomePage> {
var result = Uri.decodeFull(key);
if (routers.keys.contains(result) && result != "/") {
Future(() {
// ignore: use_build_context_synchronously
Navigator.pushNamed(context, result);
});
}
Expand Down Expand Up @@ -972,3 +973,5 @@ extension CatExtension on Cat {
}
}
}


4 changes: 2 additions & 2 deletions lib/widget/arc_seek_bar_demo_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class ArcSeekBarPainter extends CustomPainter {

void initShadowPaint() {
shadowPaint = Paint()
..color = Colors.black.withOpacity(0.3)
..color = Colors.black.withValues(alpha: 0.3)
..strokeWidth = arcPaint.strokeWidth + 4
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
Expand Down Expand Up @@ -254,7 +254,7 @@ class ArcSeekBarPainter extends CustomPainter {
..addOval(Rect.fromCircle(
center: Offset(thumbX, thumbY), radius: thumbRadius + 3));
Paint shadowPaint = Paint()
..color = Colors.black.withOpacity(0.3)
..color = Colors.black.withValues(alpha: 0.3)
..maskFilter = MaskFilter.blur(BlurStyle.normal, thumbShadowRadius);
canvas.drawPath(oval, shadowPaint);
}
Expand Down
4 changes: 1 addition & 3 deletions lib/widget/book_page/book_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ class BookPainter extends CustomPainter {
f.y = viewHeight;
_calcPointsXY(a, f);
break;
default:
break;
}
}
}

_initPaintAndPath() {
Expand Down
2 changes: 1 addition & 1 deletion lib/widget/custom_viewport/secondary_tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SecondaryTabBar extends StatelessWidget {
Widget _buildChild() {
return Container(
height: 66,
color: Colors.red.withOpacity(0.8),
color: Colors.red.withValues(alpha: 0.8),
child: const Center(child: Text('二级tab')),
);
}
Expand Down
22 changes: 10 additions & 12 deletions lib/widget/demo_navigator_new.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,22 @@ class BookRouterDelegate extends RouterDelegate<BookRoutePath>
books: books,
onTapped: _handleBookTapped,
),
onPopInvoked: (didPop, result) {
if (!didPop) {
return;
}

// Update the list of pages by setting _selectedBook to null
_selectedBook = null;
show404 = false;
notifyListeners();
},
),
if (show404)
const MaterialPage(key: ValueKey('UnknownPage'), child: UnknownScreen())
else if (_selectedBook != null)
BookDetailsPage(book: _selectedBook)
],
onPopPage: (route, result) {
if (!route.didPop(result)) {
return false;
}

// Update the list of pages by setting _selectedBook to null
_selectedBook = null;
show404 = false;
notifyListeners();

return true;
},
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:gsy_flutter_demo/widget/gesture_password/gesture_password_view.dart';
import 'package:gsy_flutter_demo/widget/link_sliver/link_flexible_space_bar.dart';

class GesturePasswordDemoPage extends StatefulWidget {
const GesturePasswordDemoPage({super.key});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class GestureViewController {
Function()? _updateView;
Offset? _firstPoint;
Offset? _movePoint;
// ignore: prefer_final_fields
List<int> _result = [];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/widget/link_sliver/link_flexible_space_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class _LinkFlexibleSpaceBarState extends State<LinkFlexibleSpaceBar> {
if (opacity > 0.0) {
TextStyle titleStyle = theme.primaryTextTheme.titleLarge!;
titleStyle = titleStyle.copyWith(
color: titleStyle.color!.withOpacity(opacity));
color: titleStyle.color!..withValues(alpha: opacity));
final bool effectiveCenterTitle = _getEffectiveCenterTitle(theme)!;
final EdgeInsetsGeometry padding = widget.titlePadding ??
EdgeInsetsDirectional.only(
Expand Down
2 changes: 1 addition & 1 deletion lib/widget/list_link_bottomsheet_demo_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: unused_field, unused_element
// ignore_for_file: unused_field, unused_element, unused_element_parameter

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/widget/photo_gallery_demo_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class _PhotoGalleryState extends State<PhotoGallery> {
colorList = List.generate(
_imgCount,
(index) => Color((Random().nextDouble() * 0xFFFFFF).toInt())
.withOpacity(1));
.withValues(alpha: 1));

super.initState();
}
Expand Down Expand Up @@ -334,7 +334,7 @@ class _AnimatedCutoutOverlay extends StatelessWidget {
// 用一个黑色的蒙层,这里的 child 会变成 effects 里 builder 里的 child
// 也就是黑色 Container 会在 _buildAnimatedCutout 作为 ClipPath 的 child
child: IgnorePointer(
child: Container(color: Colors.black.withOpacity(opacity))),
child: Container(color: Colors.black.withValues(alpha: opacity))),
),
],
);
Expand Down
2 changes: 2 additions & 0 deletions lib/widget/scroll_inner_content_demo_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/widget/scroll_to_index_demo_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class _ScrollToIndexDemoPageState extends State<ScrollToIndexDemoPage> {
key: ValueKey(index),
controller: controller!,
index: index,
highlightColor: Colors.black.withOpacity(0.1),
highlightColor: Colors.black..withValues(alpha: 0.1),
child: child,
);

Expand Down
2 changes: 2 additions & 0 deletions lib/widget/sliver_stick_demo_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously

import 'dart:math' as math;

import 'package:flutter/material.dart';
Expand Down
2 changes: 2 additions & 0 deletions lib/widget/stick/stick_demo_page2.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously

import 'dart:math' as math;

import 'package:flutter/foundation.dart';
Expand Down
2 changes: 2 additions & 0 deletions lib/widget/verification_code_input_demo_page2.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: unused_element_parameter

import 'dart:async';

import 'package:flutter/material.dart';
Expand Down

0 comments on commit e20e92c

Please sign in to comment.