zeed_stories 0.1.0
zeed_stories: ^0.1.0 copied to clipboard
Zeed SDK for Flutter
example/main.dart
import 'package:flutter/material.dart';
import 'package:zeed_stories/zeed.dart';
void main() {
ZeedConfiguration.init(
apiKey: 'YOUR_API_KEY',
clientId: 'YOUR_CLIENT_ID',
userId: 'YOUR_USER_ID');
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Zeed Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Zeed Demo Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
void _goToZeed() async {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const ZeedApp(
stock: 'NVDA',
),
),
);
}
@override
void initState() {
super.initState();
ZeedConfiguration.fetchStockList();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Please click the button to go to zeed sdk:',
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _goToZeed,
tooltip: 'Zeed',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}