Untitled
unknown
plain_text
2 years ago
1.0 kB
10
Indexable
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "News App",
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
initialRoute: NewsListPage.routeName,
routes: {NewsListPage.routeName: (context) =>NewsListPage(),
},
);
}
}
class NewsListPage extends StatelessWidget {
const NewsListPage({super.key});
static const routeName = '/article_list';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('News App'),
),
body: FutureBuilder<String>(
future:
DefaultAssetBundle.of(context).loadString('assets/articles.json'),
builder: (context, snapshot) {},
),
);
}
}Editor is loading...