Skip to content

Latest commit

 

History

History
65 lines (54 loc) · 1.8 KB

dart_2_tasks.md

File metadata and controls

65 lines (54 loc) · 1.8 KB

Easy Tasks

Make a function that return a random number from 1 to the range that has been entered as argument (parameter).

1- first time: use positional parameter

2- in another version: use named optional parameter

3- use optional parameter


Medium Task

Make Named constructors to this code for text and Icon

class InfoRow extends StatelessWidget {
  
  const InfoRow({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(24.0),
      child: Container(
        width: double.infinity,
        padding: const EdgeInsets.only(top: 15.0, bottom: 15.0),
        decoration: BoxDecoration(
            border: Border.all(width: 0.5),
            borderRadius: const BorderRadius.all(Radius.circular(15.0))),
        child: Row(
          children: <Widget>[
            Padding(
              child: Text(
                //change me as a constructor
                ' ',
                style: const TextStyle(fontSize: 18),
              ),
              padding: const EdgeInsets.only(left: 10.0),
            ),
            const Spacer(),
            Padding(
              child: SizedBox(
                child: Icon(
                  //change me as a constructor
                  Icons.notes,
                ),
                height: 25.0,
              ),
              padding: const EdgeInsets.only(right: 15.0),
            )
          ],
        ),
      ),

    );
  }
}

so it could be used as this example


to be as this when finished