Skip to main content

Posts

Showing posts with the label Material Design

Prevent MIUI Force Dark Mode From Breaking Your App's UI

  There are few moments more frustrating in Android development than receiving a bug report with a screenshot showing your meticulously crafted UI looking like an inverted photo negative. The user claims your app is "broken," showing white text on a white background or logos that look like X-ray scans. If the device is a Xiaomi, POCO, or Redmi running MIUI, your code likely isn't the culprit. The issue is MIUI's aggressive system-level "Dark Mode," which heuristically inverts colors on apps that do not explicitly declare Dark Theme support. This mechanism overrides your XML layout definitions and Drawables at the framework level. This guide provides the technical steps to disable this override and regain control of your application's rendering. The Root Cause: Algorithmic Color Inversion To understand the fix, we must understand the mechanism. Standard Android Dark Theme relies on the  DayNight  resource qualifiers (e.g.,  values-night ). If your app doe...

Handling the Forced Edge-to-Edge UI Change in Flutter 3.27+

  If you recently upgraded to Flutter 3.27 and targeted Android 15 (API level 35), you likely noticed a jarring visual regression: your application's content is suddenly drawing behind the system status bar and the bottom navigation bar. Interactive elements at the bottom of the screen are obstructed by the OS gesture handle, and your custom app bar is clashing with the system clock. This isn't a bug; it is the new standard. Android 15 enforces edge-to-edge rendering by default, and Flutter 3.27 has aligned its Android embedding implementation to match this platform requirement. The days of the OS automatically handling "safe" black bars around your UI are over. The Root Cause: Android 15 and Window Insets Historically, Android apps ran in a window frame that excluded the status bar and navigation bar. The OS painted these areas (usually black or a solid color), and the  FlutterView  occupied the remaining rectangular space. With the release of Android 15, Google depr...