"context" in the textsytle?
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Widget elevatedButton({
required IconData icons,
required title,
Function()? onPress,
}) {
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
),
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
Colors.cyan,
),
overlayColor: MaterialStateProperty.resolveWith<Color?>((
states,
) {
if (states.contains(
MaterialState.pressed,
)) return Colors.cyanAccent;
}),
),
onPressed: onPress,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
icons,
size: 15,
color: Colors.black,
),
SizedBox(
width: 5,
),
Text(
title,
//style: Theme.of(context).textTheme.button,
// context is red
),
],
),
),
);
}
Maybe you can help me again and tell me if it is possible that I can make the value "10" of Padding as a required or similar? Widget button({ required BuildContext context, required IconData icons, required title, required Function()? onPress, }) { return Padding( padding: const EdgeInsets.symmetric( horizontal: 10, <-// THIS ),
just add another double parameter like those
You can read this in the language course
I don't get it baked, would you like to briefly show it to me like the previous time?
https://dart.dev/guides/language/language-tour#parameters
Обсуждают сегодня