Last active
November 10, 2025 20:01
-
-
Save hectorAguero/4e54755964028fa74543216fbf1747a0 to your computer and use it in GitHub Desktop.
Dart Flutter Pipe Propossal Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| enum Modes { light, dark } | |
| void main() => runApp(const MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) => MaterialApp( | |
| debugShowCheckedModeBanner: false, | |
| home: Scaffold( | |
| body: Center() | |
| |> Column( | |
| space: 16, | |
| mainAxisSize: .min, | |
| mainAxisAlignment: .center, | |
| crossAxisAlignment: .center) //how fmt should handle this ? -> ) | |
| |> const [ | |
| Text('Hello, World!'), | |
| SizedBox(height: 16, width: 16), | |
| Text('Flutter ❤️ Pipe'), | |
| Padding(padding: .all(8)) | |
| |> Builder(builder: (_) => pipe) // pipe as reserved keyword? | |
| |> SafeArea() | |
| |> switch (mode) { | |
| .light => Material() | |
| |> Center() | |
| |> Text('Light Mode', style: TextStyle(color: .black)), | |
| .dark => Material() | |
| |> Center() | |
| |> Text('Dark Mode', style: TextStyle( | |
| color: .white, | |
| fontWeight: .bold, | |
| fontSize: 20) | |
| ), | |
| } | |
| |> LayoutBuilder(builder: (context, constraints) => Container( | |
| color: .blue, | |
| padding: MediaQuery.paddingOf(context).bottom, | |
| height: 100, | |
| width: constraints.maxWidth) | |
| |> Text('Context available here', | |
| style: TextStyle( | |
| color: .white, | |
| fontWeight: .bold, | |
| fontSize: 20) | |
| ), | |
| ), | |
| ), | |
| ], | |
| ), | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment