diff --git a/lib/main.dart b/lib/main.dart index b5b9dd2..ee5a955 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -26,32 +26,9 @@ class MyApp extends StatelessWidget { initialRoute: '/', onGenerateRoute: (RouteSettings settings) { return MaterialPageRoute(builder: (context) { - // The following code implements the legacy ResponsiveWrapper AutoScale functionality - // using the new ResponsiveScaledBox. The ResponsiveScaledBox widget preserves - // the legacy ResponsiveWrapper behavior, scaling the UI instead of resizing. - // - // **MaxWidthBox** - A widget that limits the maximum width. - // This is used to create a gutter area on either side of the content. - // - // **ResponsiveScaledBox** - A widget that renders its child - // with a FittedBox set to the `width` value. Set the fixed width value - // based on the active breakpoint. - return MaxWidthBox( - maxWidth: 1200, - background: Container(color: const Color(0xFFF5F5F5)), - child: ResponsiveScaledBox( - width: ResponsiveValue(context, conditionalValues: [ - Condition.equals(name: MOBILE, value: 450), - Condition.between(start: 800, end: 1100, value: 800), - Condition.between(start: 1000, end: 1200, value: 1000), - // There are no conditions for width over 1200 - // because the `maxWidth` is set to 1200 via the MaxWidthBox. - ]).value, - child: BouncingScrollWrapper.builder( - context, buildPage(settings.name ?? ''), - dragWithMouse: true), - ), - ); + return BouncingScrollWrapper.builder( + context, buildPage(settings.name ?? ''), + dragWithMouse: true); }); }, debugShowCheckedModeBanner: false, @@ -66,7 +43,12 @@ class MyApp extends StatelessWidget { case ListPage.name: return const ListPage(); case PostPage.name: - return const PostPage(); + // Custom "per-page" breakpoints. + return const ResponsiveBreakpoints(breakpoints: [ + Breakpoint(start: 0, end: 480, name: MOBILE), + Breakpoint(start: 481, end: 1200, name: TABLET), + Breakpoint(start: 1201, end: double.infinity, name: DESKTOP), + ], child: PostPage()); case TypographyPage.name: return const TypographyPage(); default: diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt index b9e550f..17411a8 100644 --- a/windows/runner/CMakeLists.txt +++ b/windows/runner/CMakeLists.txt @@ -20,6 +20,13 @@ add_executable(${BINARY_NAME} WIN32 # that need different build settings. apply_standard_settings(${BINARY_NAME}) +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + # Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index 7ce6903..cd19dbb 100644 --- a/windows/runner/Runner.rc +++ b/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