-
-
Notifications
You must be signed in to change notification settings - Fork 245
Open
Description
If you implement a custom Windows title bar alongside a Scaffold, an issue may occur when switching between two screens with different layouts.
This is likely due to a mismatch in component sizing between the two screens.
Example:
MWE:
import 'package:flutter/material.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
void main() {
runApp(const MyApp());
doWhenWindowReady(() {
appWindow.minSize = const Size(640, 480);
appWindow.size = const Size(1200, 680);
appWindow.alignment = Alignment.center;
appWindow.show();
});
}
class MyApp extends ConsumerWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
return MaterialApp(
home: Column(
children: [
Container(
color: Colors.amber,
child: WindowTitleBarBox(
child: Row(
children: [
Expanded(child: MoveWindow(child: SizedBox(height: 35))),
],
),
),
),
Expanded(child: MyHomePage(title: "MWE")),
],
),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.amber,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('You have pushed the button this many times:'),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}
Metadata
Metadata
Assignees
Labels
No labels

