ubuntu_widgets 0.2.0 ubuntu_widgets: ^0.2.0 copied to clipboard
A collection of widgets developed for Flutter-based Ubuntu applications.
import 'package:flutter/material.dart';
import 'package:yaru/yaru.dart';
import 'package:yaru_widgets/yaru_widgets.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: yaruDark,
home: Scaffold(
appBar: AppBar(),
body: Center(
child: MenuAnchor(
crossAxisUnconstrained: false,
style: MenuStyle(
maximumSize: MaterialStatePropertyAll(Size(160, 120)),
),
menuChildren: [
for (var i = 0; i < 3; ++i)
MenuItemButton(
onPressed: () {},
style: MenuItemButton.styleFrom(
side: BorderSide.none,
// minimumSize: Size(160, 40),
// maximumSize: Size(160, 40),
maximumSize: Size.infinite,
),
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Channel'),
Text('Version'),
Text('Published'),
],
),
SizedBox(width: 16),
Expanded(
//fit: FlexFit.loose,
child: Column(
children: [
Text(
'latest/candidate',
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
'1.2.2-123456789',
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
'7/22/2023',
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
],
),
),
// MenuItemButton(
// leadingIcon: const Icon(Icons.abc),
// child: const Text('bar'),
// onPressed: () {},
// ),
// MenuItemButton(
// leadingIcon: const Icon(Icons.abc),
// child: const Text('qux'),
// onPressed: () {},
// ),
],
builder: (context, controller, child) => YaruOptionButton(
onPressed: () {
if (controller.isOpen) {
controller.close();
} else {
controller.open();
}
},
child: const Icon(Icons.more_vert),
),
),
),
),
);
}
}