ubuntu / yaru.dart

Ubuntu Yaru Flutter widgets and themes for building desktop and web applications
https://ubuntu.github.io/yaru.dart/
Mozilla Public License 2.0
193 stars 35 forks source link

YaruSection: unbounded height #583

Closed jpnurmi closed 1 year ago

jpnurmi commented 1 year ago

If you don't pass any height, YaruSection eats up all it gets. Here's a centered section:

image

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

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

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return YaruTheme(
      builder: (context, yaru, child) {
        return MaterialApp(
          theme: yaru.theme,
          darkTheme: yaru.darkTheme,
          debugShowCheckedModeBanner: false,
          home: const Scaffold(
            appBar: YaruWindowTitleBar(),
            body: Center( // <==
              child: YaruSection(
                headline: Text('Section title'),
                child: Text('Section child'),
              ),
            ),
          ),
        );
      },
    );
  }
}
Feichtmeier commented 1 year ago

that's not nice by yaru section! Incredibly greedy :laughing:

Feichtmeier commented 1 year ago

it just needs a MainAxisSize parameter

Why is it inside "page" dir? And the pages are inside a different dir? :smile:

jpnurmi commented 1 year ago

I also don't know why YaruBanner is in utils/, YaruTile in pages/, and YaruWindow in controls/... :man_shrugging: Maybe we can just flatten the tree?

Feichtmeier commented 1 year ago

Good idea