push_widgets 0.1.2
push_widgets: ^0.1.2 copied to clipboard
Prefixed widgets (PW*) and Material 3 theme for Flutter apps.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:push_widgets/push_widgets.dart';
/// Simple example app to self-test the package locally.
void main() {
runApp(const PushWidgetsExampleApp());
}
class PushWidgetsExampleApp extends StatefulWidget {
const PushWidgetsExampleApp({super.key});
@override
State<PushWidgetsExampleApp> createState() => _PushWidgetsExampleAppState();
}
class _PushWidgetsExampleAppState extends State<PushWidgetsExampleApp> {
bool _isDark = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'push_widgets example',
theme: PWTheme.light,
darkTheme: PWTheme.dark,
themeMode: _isDark ? ThemeMode.dark : ThemeMode.light,
home: Scaffold(
appBar: const PWAppBar(title: 'push_widgets'),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const PWText(
'Hello from PWText! This is a wrapper over Text.',
textAlign: TextAlign.center,
),
PWSpacer.h(16),
PWButton(
onPressed: () => showPWSnackBar(context, 'PWButton clicked'),
child: const Text('Show SnackBar'),
),
PWSpacer.h(16),
PWText('Current theme: ${_isDark ? 'Dark' : 'Light'}'),
PWSpacer.h(8),
PWButton(
onPressed: () => setState(() => _isDark = !_isDark),
child: const Text('Toggle Theme'),
),
PWSpacer.h(16),
const PWText('PWRow with gap:'),
PWSpacer.h(8),
const PWRow(
gap: 8,
children: [
PWText('Row A'),
PWText('Row B'),
PWText('Row C'),
],
),
PWSpacer.h(16),
const PWText('PWColumn with gap:'),
PWSpacer.h(8),
const PWColumn(
gap: 8,
children: [
PWText('Column A'),
PWText('Column B'),
PWText('Column C'),
],
),
PWSpacer.h(16),
PWButton(
onPressed: () => showPWBottomSheet(
context,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const PWText('PWBottomSheet'),
PWSpacer.h(8),
const PWText('This is a modal bottom sheet with M3 styling.'),
],
),
),
),
child: const Text('Show Bottom Sheet'),
),
],
),
),
),
);
}
}