iTranslated by AI
Achieving Design Freedom in Flutter App Development with WidgetsApp
Apple announced Liquid Glass at WWDC25.
In response to this, some have voiced that "Flutter, which does not use native APIs, will be left behind by the times." However, as stated in the FAQ page below, Flutter is designed to prioritize the flexible realization of brand designs for each project and company without relying on native APIs. Therefore, it is more accurate to say that reproducing Liquid Glass as a Flutter framework is "not prioritized in the first place."
Modern app design trends point towards designers and users wanting more motion-rich UIs and brand-first designs. In order to achieve that level of customized, beautiful design, Flutter is architectured to drive pixels instead of the built-in widgets.
Nearly 20 years have passed since the introduction of smartphones, and a diverse range of users utilize them for various reasons and purposes. From a provider's perspective, the challenges to be solved through "apps" vary greatly. While the latest design proposed by Apple is certainly wonderful, whether it is "optimal" for all users and providers is a different story.
What "users want" and what a "product wants to provide" differ completely for each project. Flutter's policy is that there is a need to pursue original designs without being influenced by platform design changes, and Flutter is the framework to meet that need.
Also, though it may be a pragmatic reason, there are cases where "design" itself is not the top priority for a product. There is a definite need to release and validate ideas that can solve as many people's problems as quickly as possible, rather than spending time obsessing over appearance.
In any case, the common thread is the requirement to "develop apps without being pushed around by platform constraints," and Flutter's custom rendering mechanism fulfills this.
As a side note, what Flutter cannot (or does not) do is "provide Widgets that perfectly reproduce platform-standard mechanisms as part of the Flutter framework." If you don't limit yourself to that, you can use PlatformView to place native components themselves on the UI, or (someone could) create Widgets with similar looks and behaviors as third-party packages. Even if subtle differences arise, not all users will necessarily feel out of place, nor will they uninstall the app for that reason. [1]
That was a long introduction, but in short, Flutter apps shine most when you want to faithfully realize a designer's ideas without depending on a specific design philosophy.
However, the Widgets provided by material.dart, including the commonly used MaterialApp in Flutter app development, have pre-implemented fixed values and rules to ensure they don't deviate from Material Design. This often hinders the faithful reproduction of a designer's ideas.
Therefore, in this article, I would like to experiment with setting aside MaterialApp and trying to achieve free design with WidgetsApp, while exploring what hurdles arise and how to overcome them.
Revisiting runApp()
First, let's look at the minimal code for a Flutter app to set aside fixed ideas.
import 'package:flutter/widgets.dart';
void main() => runApp(
Center(child: Container(width: 50, height: 50, color: Color(0xff00ff00))),
);
This simple 5-line code is perfectly executable as a Flutter app. A green square is displayed in the center of a black background.

As you can see from this, MaterialApp is not mandatory to run a Flutter app.
As long as you pass a Widget to runApp(), you can build a UI without MaterialApp. You could also create an interactive app by using StatefulWidget, InheritedWidget, or Riverpod there.
That said, in actual development, MaterialApp is used in most cases. First, let's organize why we use MaterialApp and what role it plays.
The Role of MaterialApp
Organizing the roles of MaterialApp while reading the documentation and the implementation in material/app.dart, it roughly does the following:
- Reads device settings and places
MediaQuery,Directionality,Localization, etc. - Prepares mechanisms available app-wide, such as
SharedAppData. - Places
Navigatorand handles routing settings. - Sets styles for Material components and
TextviaTheme. - Handles accessibility.
- Other preparations for using Material components.
All of these are necessary if you intend to create a proper app.
Even for a single Text, there is a lot of information to consider, such as what color or font to display it in, whether it is LTR or RTL, and what the device's text scaling settings are.
This information is delivered to individual Text widgets using InheritedWidgets like DefaultTextStyle. Without MaterialApp, these Widgets are not placed, and an error occurs the moment you place a Text widget.
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞════════════════════════
The following assertion was thrown building Text("hello", dependencies: [MediaQuery]):
No Directionality widget found.
RichText widgets require a Directionality widget ancestor.
The specific widget that could not find a Directionality ancestor was
...(omitted)
You might think, "See, MaterialApp is necessary after all," but actually, most of these are the job of WidgetsApp internally. Specifically:
- Reading device settings and placing
MediaQuery,Directionality,Localization, etc. - Preparing mechanisms available app-wide, such as
SharedAppData. - Placing
Navigatorand handling routing settings.
These are achieved simply by MaterialApp placing WidgetsApp within its own build(). The job of MaterialApp itself is to place various widgets for Material components, such as Theme and HeroControllerScope, above and below WidgetsApp.
In other words, if you don't need Material Design or Widgets that follow it, by replacing MaterialApp with WidgetsApp, and by primarily using Widgets prepared in widgets.dart instead of material.dart, you can achieve a design that is not bound by Material Design constraints (though it will require a fair amount of work).
Building an App with WidgetsApp
Now, let's experience a bit of app development without relying on Material Design.
Just one note: since we are building this without "relying on Material Design," the appearance might look a bit "plain" when created by a developer like myself who lacks design expertise. Please read along while imagining that, in a real-world scenario, the appearance would be improved by faithfully reproducing a polished design created by a professional designer.
Creating main.dart
First, let's place WidgetsApp in main.dart.
import 'package:flutter/widgets.dart';
void main() => runApp(const MainApp());
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) =>
WidgetsApp(color: const Color(0xFF1E1E1E), home: Container());
}
The only mandatory argument for WidgetsApp is color. The color specified here is passed to a Widget called Title internally and is used in platform-specific UIs such as the Application Switcher. Since widgets.dart doesn't have Widgets like AppBar or FloatingActionButton that follow default colors, the color specified here won't be reflected in any Widgets.
When you place a Container in the home property for the initial display and run the app, an error occurs, unlike with MaterialApp.
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building MainApp(dirty):
If neither builder nor onGenerateRoute are provided, the pageRouteBuilder must be specified so that the default handler will know what kind of PageRoute transition to build.
'package:flutter/src/widgets/app.dart':
Failed assertion: line 406 pos 10: 'builder != null || onGenerateRoute != null || pageRouteBuilder != null'
Reading the error message, it seems that routing-related settings are missing. This means you must specify either builder and onGenerateRoute as a set, or specify pageRouteBuilder to manage the PageRoute for the initial screen.
If you read the MaterialApp code, you'll see that when you simply specify the initial screen with MaterialApp.home (as in a counter app), a pageRouteBuilder like the following is internally specified for WidgetsApp.
return WidgetsApp(
...omitted
pageRouteBuilder: <T>(RouteSettings settings, WidgetBuilder builder) {
return MaterialPageRoute<T>(settings: settings, builder: builder);
},
home: widget.home,
...omitted
);
So, we want to specify pageRouteBuilder in the same way this time. However, the MaterialPageRoute passed by MaterialApp is a PageRoute with the functionality to "reproduce platform-specific screen transition animations for iOS/Android." Using this would mean depending on material.dart and, internally, even cupertino.dart.
If you're fine with "platform-standard screen transitions," you can just mimic this. But if you want to define the screen transition animation itself uniquely, you should define your own PageRouteBuilder by referring to the official documentation below.
@override
Widget build(BuildContext context) => WidgetsApp(
color: const Color(0xFF1E1E1E),
pageRouteBuilder:
// For now, a PageRouteBuilder that just displays the Widget without animation
<T>(settings, builder) => PageRouteBuilder(
pageBuilder: (context, _, _) => builder(context),
transitionsBuilder: (_, _, _, child) => child,
),
home: Container(),
);
Normally, you would define the animation for screen transitions in this PageRouteBuilder, but to move forward, we'll just display the Widget specified in home as is for now.
With this, the app should run without errors and display a black screen. At this point, at least WidgetsApp is in place, and mechanisms like MediaQuery and Navigator are ready to use.
Creating a List Page
Now, let's create a top list screen here. We will create something that looks like a user list page named UserListPage.
Even though we are creating a screen, we won't use Scaffold. That is used when you want to place AppBar or FloatingActionButton with a layout and design compliant with Material Design, and it becomes a hindrance to achieving a unique design. If the man-hours required to keep up with things like Material 3 or Expressive are a concern, not using it is an option to consider.
Instead, we will set the background color with ColoredBox and use ListView as usual for the list UI.
/// User list page
class UserListPage extends StatelessWidget {
const UserListPage({super.key});
@override
Widget build(BuildContext context) {
return ColoredBox( // Background color
color: const Color(0xFF1E1E1E),
child: ListView.builder(
itemCount: users.length,
itemBuilder: (context, index) {
final user = users[index];
return _ListTile(user: user);
},
),
);
}
}
ListTile, which is often used in combination with ListView, belongs to material.dart. The details of the layout, such as margins, are specified internally by ListTileTheme, and its content switches depending on whether it's set to use Material 3 or not. In other words, this is also a Widget that depends on Material Design and can be difficult to handle when aiming for a unique design.
Therefore, we will create our own _ListTile here.
/// Widget representing a single row for one user
class _ListTile extends StatelessWidget {
const _ListTile({required this.user});
final User user;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
decoration: const BoxDecoration(
border: Border(bottom: BorderSide(color: Color(0xFF333333), width: 1)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
... (omitted)
),
],
),
);
}
}
By doing this, we have created a plausible user list screen like the one below.

Although not used this time, it's worth noting as a point for creating detailed UIs that Icons (not the Icon widget) and Colors are also icon and color definitions based on Material Design.
If you want to place unique icons, you need to consider defining them in a .ttf file to be handled as IconData, or creating them in SVG and displaying them with flutter_svg. For colors, please define them yourself in the format const Color(0xff000000).
Creating a Detail Page
Now, let's create the part where "tapping transitions to a detail screen."
There are various things to consider and do here as well:
- Implementing feedback for tap operations
- Implementing screen transition animations
- Implementing the "Back" UI
You need to manually create parts that Widgets in material.dart like InkWell, MaterialPageRoute, and AppBar normally handle for you. Since specific effects would actually be discussed with a designer, we will look at one example here to confirm the implementation method.
Feedback for Tap Operations
First, to enable the previously created _ListTile to transition to a new screen when tapped, we will place a GestureDetector. However, unlike InkWell, GestureDetector does not provide any UI feedback when pressed. In other words, you need to implement the "pressed feel" yourself.
There are many possible ways to do this, but for now, let's use a StatefulWidget to switch the UI between the "normal state" and the "touched state." You can achieve smooth transitions by using Animated widgets (introduced as Implicit Animations in the official documentation).
class _ListTile extends StatefulWidget { // Change to StatefulWidget
const _ListTile({required this.user, required this.onTap});
final User user;
final VoidCallback onTap; // Callback on tap
@override
State<_ListTile> createState() => _ListTileState();
}
class _ListTileState extends State<_ListTile> {
bool isPressed = false; // Flag for whether it is being tapped
@override
Widget build(BuildContext context) {
return GestureDetector(
// Handle tap
onTapDown: (details) => setState(() => isPressed = true),
onTapUp: (details) => setState(() => isPressed = false),
onTap: widget.onTap,
// Switch UI based on tap state
child: Container(
decoration: BoxDecoration(
color: isPressed ? const Color(0xFF111111) : const Color(0xFF000000),
),
child: AnimatedScale( // Slightly shrink when tapped
alignment: Alignment.centerLeft,
scale: isPressed ? 0.90 : 1,
duration: const Duration(milliseconds: 100),
curve: Curves.fastEaseInToSlowEaseOut,
child: Column(
... (omitted)

This example simply changes the background color and slightly shrinks the content, but by applying it further—for instance, by refining the animation during tapping or implementing the widget.onTap call to trigger after "holding for 2 seconds or more"—you can create various operational feels yourself.
Screen Transition Animations
Screen transitions can be performed using Navigator.of(context).push() as usual.
However, the MaterialPageRoute typically passed to push() is a class designed to "reproduce platform-standard transition animations." If you want to customize the screen transition animation itself, you need to create your own animation using PageRouteBuilder.
return _ListTile(
user: user,
onTap: () {
Navigator.of(context).push(
// Create a custom screen transition animation
PageRouteBuilder(
// Function that generates the Widget for the next page
pageBuilder:
(context, animation, secondaryAnimation) =>
UserDetailPage(user: user),
// Function that generates a Widget that animates the child representing the next page
// using animation and secondaryAnimation
transitionsBuilder:
(context, animation, secondaryAnimation, child) =>
FadeTransition(opacity: animation, child: child),
),
);
},
);
pageBuilder is a function for generating the Widget that represents the next page. In MaterialPageRoute, you would likely write builder: (context) => UserDetailPage(user: user), so it plays a similar role.
transitionsBuilder is a function for implementing the animation, receiving the Widget generated by the aforementioned pageBuilder as child.
Since the animation argument provides the "current state of the animation" as it changes from 0.0 to 1.0, you can achieve unique animations by passing this to Animated-style widgets or combining it with Curve and Tween. In this example, I used FadeTransition to create a screen transition that fades in softly.

More details, such as the difference between animation and secondaryAnimation, are explained in the following documentation. If you are interested, feel free to read and try it out.
However, if you feel that "platform-standard screen transitions are better," you can also use MaterialPageRoute specifically for this part. Using MaterialPageRoute will handle not only the animation but also back gestures like "swiping from the screen edge" on iPhone.
You can consider using custom animations when you want to build special expressions, such as sliding vertically or adding a page-turning effect; otherwise, you can use MaterialPageRoute as usual.
Implementing the "Back" UI
As mentioned earlier, if you don't use MaterialPageRoute, you need a mechanism to execute Navigator.of(context).pop() somewhere.
In this case, I made the UserDetailPage return to the previous screen when any part of the screen is tapped.
/// User detail page
class UserDetailPage extends StatelessWidget {
const UserDetailPage({super.key, required this.user});
final User user;
@override
Widget build(BuildContext context) {
return GestureDetector( // Return when the screen is tapped
onTap: () => Navigator.of(context).pop(),
child: Container(
height: double.infinity,
width: double.infinity,
... (omitted)
That said, users are likely accustomed to the "Back" gestures in both Android and iOS, so naturally incorporating operations that deviate from those seems quite difficult from a design perspective. [2]
In that sense, unless you have a specific preference, it is likely best to stick with MaterialPageRoute for screen transitions.
Other
To add a point regarding screen transitions, the showDialog function for displaying dialogs is a mechanism provided in material.dart, which applies styles like DialogTheme provided by MaterialApp to the UI.
Therefore, if you want to display a uniquely designed dialog, please use showGeneralDialog(). In that case, you will also need a pageBuilder to define how the dialog is displayed and its animations.
Similarly, showBottomSheet and showModalBottomSheet are also built on the premise of Material Design. If you want to achieve a "UI that slides up from the bottom," you should define such an animation in PageRouteBuilder and use Navigator.of(context).push(). If you read the internal implementation, you will see that showDialog and showModalBottomSheet ultimately call Navigator.of(context).push() inside, so you can do the same thing with a custom animation. (By the way, showBottomSheet is different in that Scaffold simply overlays the Widget at the bottom of the screen using setState(), and it does not use Navigator.)
Regarding "bottom-up expressions," DraggableScrollableSheet is a Widget in widgets.dart that does not have a specific theme, so it is also worth considering.
Standardizing the Background Color
Up to this point, we've specified the same background color for both UserListPage and UserDetailPage, but styles specified across the app, like background color and text styles, should be standardized.
While this can be achieved by defining constants somewhere and calling them every time, that approach can't flexibly handle requirements like "I want to change the color inside this Widget" (e.g., the requirement where an Icon under a FloatingActionButton automatically becomes white).
Therefore, let's try creating a simple PageTheme class using InheritedWidget. We'll build it by referring to what material.dart does internally.
First, define a PageThemeData class to hold settings common to each page.
/// Class that holds the page style. In this case, only the background color.
class PageThemeData {
const PageThemeData({required this.backgroundColor});
final Color backgroundColor;
}
Next, create an InheritedWidget named PageTheme. InheritedWidget is a mechanism that allows descendant Widgets to access data in O(1) time from within their build() methods. [3] We'll have it hold the PageThemeData we just created.
class PageTheme extends InheritedWidget {
const PageTheme({super.key, required super.child, required this.data});
final PageThemeData data;
/// Rebuild consumers when [data] changes
@override
bool updateShouldNotify(PageTheme oldWidget) => data != oldWidget.data;
/// Method for descendants to obtain [PageThemeData] via `PageTheme.of(context)`
static PageThemeData of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<PageTheme>()!.data;
}
Finally, wrap the WidgetsApp in main.dart as follows.
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) => PageTheme( // Wrap WidgetsApp with PageTheme
data: const PageThemeData(backgroundColor: Color(0xFF1E1E1E)), // App-wide settings
child: WidgetsApp(
... (omitted)
),
);
}
By doing this, UserListPage and UserDetailPage will be able to apply the background color set for the entire app using PageTheme.of(context).backgroundColor. If you have various other common screen settings, it might be good to create a Widget like AppScaffold that handles the same role as Scaffold and reuse it on each page.
Similarly, if design rules define several text sizes, you should create an AppTextTheme class in the same manner.
These efforts might seem like a rehash of TextTheme in material.dart, but there's a significant difference in the degree of freedom in both design and implementation between "fitting a design into choices defined in Material Design (bodyMedium, displayLarge, etc.)" and "defining choices defined by a designer directly in code." While using TextTheme as a reference for implementation patterns, you should aim for an implementation that perfectly matches the designer's definitions.
Handling Accessibility
Up to this point, we've addressed parts that are visually obvious, but this alone is insufficient for crafting a complete UI. ElevatedButton, MaterialPageRoute, and others provided by material.dart use Semantics and Tooltip appropriately to support screen reading features, allowing users who cannot see the screen directly to operate the app.
For example, the build() method of ButtonStyleButton, the parent class of ElevatedButton, is implemented as follows.
return Semantics(
container: true,
button: widget.isSemanticButton,
enabled: widget.enabled,
child: _InputPadding(
minSize: minSize,
child: ConstrainedBox(
... (omitted)
In Flutter, by placing Semantics widgets in appropriate locations like this, a Semantics tree is formed internally, and the content to be read aloud when the screen is displayed is constructed.
In Semantics, you can set the read-aloud content with label, while also passing flags that represent "what role the component plays," such as button or slider. Together, these provide a mechanism to understand things like "a button labeled 'Confirm' is placed" without looking at the screen.
However, if you forget to place these Semantics or Tooltip widgets when creating custom components like buttons, the aforementioned reading will not be performed correctly.
This need for manual handling is arguably the most difficult part of implementing a unique design [4], but since it is a necessary element, let's implement a few while mimicking the implementation in material.dart.
Accessibility for PageRouteBuilder
Looking at the implementation of MaterialPageRoute, Semantics is set as follows.
@override
Widget buildPage(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
final Widget result = buildContent(context);
return Semantics(scopesRoute: true, explicitChildNodes: true, child: result);
}
This sets that "this result widget represents a page" (or more accurately, "it becomes the head of the Semantics subtree"). Now, let's modify the previous PageRouteBuilder in the same way.
Navigator.of(context).push(
PageRouteBuilder(
pageBuilder:
(context, animation, secondaryAnimation) =>
Semantics(
scopesRoute: true,
explicitChildNodes: true,
child: UserDetailPage(user: user),
),
transitionsBuilder:
(context, animation, secondaryAnimation, child) =>
FadeTransition(opacity: animation, child: child),
),
);
Since it's not realistic to implement PageRouteBuilder and remember Semantics every time you transition screens, it would be better to standardize this part.
Accessibility for _ListTile
The GestureDetector placed for tapping _ListTile also doesn't support reading as is. For example, let's place a Semantics widget to set that "this is a button to open details" as follows.
return Semantics(
button: true,
label: '${widget.user.name} details',
child: GestureDetector(
onTapDown: (details) => setState(() => isPressed = true),
In this way, by wrapping custom components in Semantics and applying appropriate settings as needed, the app becomes usable for more users. In doing so, it would be a good idea to follow the build() methods of Widgets implemented in material.dart to see how they place Semantics.
However, at least as of writing this article, I am a novice regarding Semantics, so if there are any errors in usage, I would appreciate your comments. I will continue to check how specifying what and where changes the behavior.
Summary
In this article, we've experimented with a simple app to see what implementation looks like when you want to pursue a unique design without using MaterialApp. While I expect more issues to arise that haven't been mentioned here, I think you've gotten a general idea of how to start.
Note that state management mechanisms like Riverpod and business logic are not affected at all by this attempt. In Flutter, state management is independent of the UI, which makes it easy to separate it from design trial and error.
To reiterate, Material Design is not mandatory in Flutter app development. Rather, it can even be a hindrance to achieving the "brand-optimized design" that Flutter originally intended.
By viewing WidgetsApp not just as an "internally used Widget" but as "something to actively consider when you want to achieve a unique design," I believe the use cases for Flutter apps will expand further.
-
If you're building the kind of app where users leave for that reason, Flutter might even be considered an inappropriate technical choice in the first place. ↩︎
-
I'm a developer, so I can only imagine the difficulties designers face. ↩︎
-
For more details, please also read the article I wrote previously, 【Flutter】What is InheritedWidget?. ↩︎
-
To put it positively, you could say "accessibility can also be crafted to match the app." ↩︎
Discussion