Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.0 kB
3
Indexable
Never
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) {},
      ),
    );
  }
}