yaru.dart icon indicating copy to clipboard operation
yaru.dart copied to clipboard

YaruWindowTitleBar widget doesn't centre title properly

Open whiskeyPeak opened this issue 2 years ago • 1 comments

Might be hard to see but there is a slightly larger gap at the top compared to at the bottom.

Screenshot from 2023-02-10 22-53-08

Repro code:

import 'package:flutter/material.dart';
import 'package:window_manager/window_manager.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await windowManager.ensureInitialized();
  await YaruWindowTitleBar.ensureInitialized();

  windowManager.setPreventClose(false);

  runApp(
    const MyApp(),
  );
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark(),
      debugShowCheckedModeBanner: false,
      home: const HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return YaruMasterDetailPage(
      appBar: const YaruWindowTitleBar(),
      layoutDelegate: const YaruMasterResizablePaneDelegate(
        initialPaneWidth: 300,
        minPageWidth: 200,
        minPaneWidth: 200,
      ),
      tileBuilder: (context, index, selected) => const YaruMasterTile(
        title: Text("title 1"),
      ),
      pageBuilder: (context, index) => YaruDetailPage(
        appBar: YaruWindowTitleBar(
          title: Center(
            child: Container(
              height: 40,
              color: Colors.grey[800],
            ),
          ),
        ),
      ),
      length: 1,
    );
  }
}


whiskeyPeak avatar Feb 10 '23 22:02 whiskeyPeak