Created
February 8, 2022 20:33
-
-
Save pingbird/8cb3d913a19c496fb9511858990488b9 to your computer and use it in GitHub Desktop.
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:boxy/flex.dart'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatefulWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
_MyAppState createState() => _MyAppState(); | |
} | |
class _MyAppState extends State<MyApp> { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
body: ListView( | |
children: const [ | |
TestChild(), | |
], | |
), | |
), | |
); | |
} | |
} | |
class TestChild extends StatelessWidget { | |
const TestChild({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
decoration: BoxDecoration( | |
border: Border.all(color: Colors.black12, width: 2.0), | |
borderRadius: BorderRadius.circular(4.0), | |
), | |
padding: const EdgeInsets.all(16.0), | |
margin: const EdgeInsets.all(16.0), | |
child: BoxyRow( | |
intrinsicsBehavior: BoxyFlexIntrinsicsBehavior.measureCross, | |
children: [ | |
AspectRatio( | |
aspectRatio: 1.0, | |
child: Container( | |
decoration: const BoxDecoration( | |
color: Colors.white, | |
shape: BoxShape.circle, | |
boxShadow: [BoxShadow(blurRadius: 8.0, color: Colors.black38)], | |
), | |
padding: const EdgeInsets.all(5.0), | |
child: const CircleAvatar( | |
backgroundImage: NetworkImage('https://i.tst.sh/q09LW.png'), | |
), | |
), | |
), | |
const SizedBox(width: 16), | |
Dominant.expanded( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
mainAxisSize: MainAxisSize.min, | |
children: [ | |
Text( | |
'Hello, World!', | |
style: Theme.of(context).textTheme.headline2!.copyWith( | |
color: Colors.black, | |
fontSize: 48.0, | |
), | |
maxLines: 1, | |
), | |
Text( | |
'big chungus ' * 10, | |
style: Theme.of(context).textTheme.headline3!.copyWith( | |
color: Colors.black, | |
fontSize: 48.0, | |
), | |
maxLines: 1, | |
), | |
], | |
), | |
) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment