Вы могли бы сделать:
define( 'FOO', 'bar' );
$constants = get_defined_constants(true); // the true argument categorizes the constants
$constants = $constants[ 'user' ]; // this gets only user-defined constants
echo "Hello, my name is {$constants['FOO']}";
Я рекомендую вам начать строить макеты только с Row
и Column
, чтобы не запутаться. Я часто строю макеты следующим образом.
Row
и Column
. И установить свойства mainAxisAlignment
и crossAxisAlignment
в Row
и Column
. Padding
или Align
, Expanded
и т. Д. Вы также можете использовать Container
. Ссылка:
Базовая раскладка:
https://flutter.dev/docs/development/ Пользовательский интерфейс / макет
Советы по созданию макетов:
Надеюсь, вам это поможет.
пример кода:
Widget buildCard() {
return Container(
margin: EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color.fromARGB(100, 0, 0, 0),
blurRadius: 5,
),
],
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Image.asset(
'assets/card.png',
height: 62,
width: 62,
fit: BoxFit.cover,
),
Padding(
padding: const EdgeInsets.only(top: 12.0, left: 12.0),
child: Text(
"Hello world",
style: TextStyle(
fontWeight: FontWeight.w500,
letterSpacing: 0.8,
),
),
)
],
),
);
}