diff --git a/example/lib/demo/issue181_overstep.dart b/example/lib/demo/issue181_overstep.dart new file mode 100644 index 0000000..ac9729e --- /dev/null +++ b/example/lib/demo/issue181_overstep.dart @@ -0,0 +1,130 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; + +void main() => runApp(const MyApp()); + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return MaterialApp( + // home: const _TestingDialog(), + home: const DialogTestPage(), + navigatorObservers: [FlutterSmartDialog.observer], + builder: FlutterSmartDialog.init(), + ); + } +} + +class DialogTestPage extends StatelessWidget { + const DialogTestPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.green, + floatingActionButton: FloatingActionButton( + onPressed: () { + SmartDialog.show( + clickMaskDismiss: false, + builder: (_) => const _TestingDialog(), + ); + }, + child: const Icon(Icons.add), + ), + ); + } +} + +class _TestingDialog extends StatefulWidget { + const _TestingDialog(); + + @override + State<_TestingDialog> createState() => _TestingDialogState(); +} + +class _TestingDialogState extends State<_TestingDialog> + with SingleTickerProviderStateMixin { + late AnimationController animationController; + Tween tween = Tween(begin: 0, end: 50); + + @override + void initState() { + super.initState(); + animationController = AnimationController( + duration: const Duration(milliseconds: 800), + vsync: this, + ); + + WidgetsBinding.instance.addPostFrameCallback((_) { + Future.delayed(const Duration(milliseconds: 300), () { + animationController.forward(); + }); + }); + } + + @override + void dispose() { + animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Center( + child: Container( + margin: const EdgeInsets.symmetric(horizontal: 16), + child: Stack( + clipBehavior: Clip.none, + alignment: Alignment.bottomCenter, + children: [ + // 这里,点击事件也可以传递到遮罩 + SizedBox(height: MediaQuery.of(context).size.height,width: MediaQuery.of(context).size.width), + Container(height: 300, color: Colors.blue), + AnimatedBuilder( + animation: animationController, + builder: (_, child) { + return Transform.translate( + offset: + Offset(0, -(100 + tween.evaluate(animationController))), + child: child, + ); + }, + child: Container( + height: 200, + width: 200, + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: () { + SmartDialog.dismiss(); + print("111111111111"); + }, + child: const Row(children: [ + Icon(Icons.close), + Text('<-用不了的'), + ]), + ), + InkWell( + onTap: () { + SmartDialog.dismiss(); + print("2222222222222"); + }, + child: const Row(children: [ + Icon(Icons.close), + Text('<-能用的'), + ]), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/example/pubspec.yaml b/example/pubspec.yaml index b034aff..190cd1d 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=2.17.0 <3.0.0" dependencies: flutter: diff --git a/example/windows/flutter/CMakeLists.txt b/example/windows/flutter/CMakeLists.txt index b02c548..86edc67 100644 --- a/example/windows/flutter/CMakeLists.txt +++ b/example/windows/flutter/CMakeLists.txt @@ -9,6 +9,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake) # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") @@ -91,7 +96,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS diff --git a/example/windows/runner/Runner.rc b/example/windows/runner/Runner.rc index 37557d2..8ab0ed7 100644 --- a/example/windows/runner/Runner.rc +++ b/example/windows/runner/Runner.rc @@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico" // Version // -#ifdef FLUTTER_BUILD_NUMBER -#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD #else -#define VERSION_AS_NUMBER 1,0,0 +#define VERSION_AS_NUMBER 1,0,0,0 #endif -#ifdef FLUTTER_BUILD_NAME -#define VERSION_AS_STRING #FLUTTER_BUILD_NAME +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION #else #define VERSION_AS_STRING "1.0.0" #endif