-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
106 additions
and
79 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
notes/flutter_web/lib/routes/notes/cheatsheets/widgets/_examples/Decorator_Badge.dart
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
main() { | ||
runApp(const MaterialApp(home: Scaffold(body: Decorator_Badge()))); | ||
} | ||
|
||
// ignore: camel_case_types | ||
class Decorator_Badge extends StatelessWidget { | ||
const Decorator_Badge({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ | ||
Badge.count(count: 1000, child: const Icon(Icons.mail_outlined)), | ||
const Badge(child: Icon(Icons.sms_failed_outlined)), | ||
Badge.count(count: 23, child: ElevatedButton(onPressed: () {}, child: const Text("Button"))), | ||
const Badge( | ||
label: Text("2000 ¥"), | ||
alignment: AlignmentDirectional.bottomCenter, | ||
child: Card( | ||
elevation: 4, | ||
color: Colors.green, | ||
child: Padding(padding: EdgeInsets.all(20), child: Text('Card')), | ||
), | ||
), | ||
]); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
notes/flutter_web/lib/routes/notes/cheatsheets/widgets/_examples/Decorator_Card.dart
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
main() { | ||
runApp(const MaterialApp(home: Scaffold(body: Decorator_Card()))); | ||
} | ||
|
||
// ignore: camel_case_types | ||
class Decorator_Card extends StatelessWidget { | ||
const Decorator_Card({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
var colors = Theme.of(context).colorScheme; | ||
return Wrap( | ||
children: [ | ||
Card( | ||
elevation: 4, | ||
child: Container( | ||
width: 80, | ||
height: 80, | ||
alignment: Alignment.center, | ||
padding: const EdgeInsets.fromLTRB(10, 5, 5, 10), | ||
child: const Text('Elevated'), | ||
), | ||
), | ||
Card( | ||
elevation: 0, | ||
color: colors.surfaceDim, | ||
child: Container( | ||
width: 80, | ||
height: 80, | ||
alignment: Alignment.center, | ||
child: const Text('Filled'), | ||
), | ||
), | ||
Card( | ||
elevation: 4, | ||
shape: RoundedRectangleBorder( | ||
side: BorderSide(color: colors.outlineVariant), | ||
borderRadius: const BorderRadius.all(Radius.circular(12)), | ||
), | ||
child: Container( | ||
width: 80, | ||
height: 80, | ||
alignment: Alignment.center, | ||
child: const Text('Border'), | ||
), | ||
), | ||
], | ||
); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
notes/flutter_web/lib/routes/notes/cheatsheets/widgets/_examples/Decorator_CircleAvatar.dart
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
main() { | ||
runApp(const MaterialApp(home: Scaffold(body: Decorator_CircleAvatar()))); | ||
} | ||
|
||
// ignore: camel_case_types | ||
class Decorator_CircleAvatar extends StatelessWidget { | ||
const Decorator_CircleAvatar({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const Row(children: [ | ||
CircleAvatar(child: Text('C')), | ||
CircleAvatar(child: Icon(Icons.account_box)), | ||
CircleAvatar(backgroundImage: NetworkImage('https://avatars.githubusercontent.com/u/2039742')), | ||
CircleAvatar(backgroundImage: NetworkImage('https://img2.baidu.com/it/u=3784833129,896943374&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500')), | ||
]); | ||
} | ||
} |
This file contains 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