Saturday, June 19, 2021

【FLUTTER ANDROID STUDIO and IOS】Detail Page View Meal App

 import 'package:flutter/material.dart';


import 'dummy_data.dart';

class MealDetailScreen extends StatelessWidget {
static const routeName = '/meal-detail';

Widget buildSectionTitle(BuildContext context, String text) {
return Container(
margin: EdgeInsets.symmetric(vertical: 10),
child: Text(
text,
style: Theme
.of(context)
.textTheme
.headline6,
),
);
}

Widget buildContainer(Widget child) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(10),
),
margin: EdgeInsets.all(10),
padding: EdgeInsets.all(10),
height: 150,
width: 300,
child: child,
);
}
@override
Widget build(BuildContext context) {
final mealId = ModalRoute
.of(context)
.settings
.arguments as String;
final selectedMeal = DUMMY_MEALS.firstWhere((meal) => meal.id == mealId);
return Scaffold(
appBar: AppBar(title: Text('${selectedMeal.title}'),),
body: Center(
child: Text('The meal - $mealId!'),
),
);
}
}

No comments:

Post a Comment

End of Summer Sale ☀️😎

20% OFF Inside!🤯 ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏...