order_book 0.0.2
order_book: ^0.0.2 copied to clipboard
Binance Order Book
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:order_book/order_book.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Order Book Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
debugShowCheckedModeBanner: false,
home: const OrderBookDemo(),
);
}
}
class OrderBookDemo extends StatefulWidget {
const OrderBookDemo({Key? key}) : super(key: key);
@override
State<OrderBookDemo> createState() => _OrderBookDemoState();
}
class _OrderBookDemoState extends State<OrderBookDemo> {
@override
Widget build(BuildContext context) {
return SafeArea(child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
title: const Text(
'Order Book Demo',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600
),
),
centerTitle: true,
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(20.0),
child: Center(
child: SizedBox(
width: MediaQuery.of(context).size.width,
height: 300,
child: OrderBookWidget(
pair: 'ethusdt',
count: 10,
loaderColor: Colors.black,
onClick: (value){
print(value.toString());
},
priceWidget: const Text(
'Price',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600
),
textAlign: TextAlign.start,
),
volumeWidget: const Text(
'Amount',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600
),
textAlign: TextAlign.end,
),
buyPriceStyle: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w800,
color: Colors.green
),
buyVolumeStyle: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w800,
color: Colors.black87
),
sellPriceStyle: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w800,
color: Colors.red
),
sellVolumeStyle: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w800,
color: Colors.black87
),
),
),
),
),
));
}
}