feat: fake orders
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:gymlink_module_web/components/app_bar.dart';
|
||||
import 'package:gymlink_module_web/components/heading.dart';
|
||||
import 'package:gymlink_module_web/components/order_detail_item_card.dart';
|
||||
import 'package:gymlink_module_web/interfaces/items.dart';
|
||||
import 'package:gymlink_module_web/tools/history.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
final GymHistoryItemDetail item = GymHistoryItemDetail.fromJson({
|
||||
@@ -38,7 +39,6 @@ final GymHistoryItemDetail item = GymHistoryItemDetail.fromJson({
|
||||
]
|
||||
});
|
||||
|
||||
//FIXME: Починить скролл
|
||||
class OrderInfoPage extends StatefulWidget {
|
||||
final String id;
|
||||
const OrderInfoPage({super.key, required this.id});
|
||||
@@ -51,6 +51,7 @@ class _OrderInfoPageState extends State<OrderInfoPage> {
|
||||
GymHistoryItemDetail? detail;
|
||||
final _scrollController = ScrollController();
|
||||
late Timer _updateTimer;
|
||||
bool _isRefreshing = false;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -65,9 +66,11 @@ class _OrderInfoPageState extends State<OrderInfoPage> {
|
||||
}
|
||||
|
||||
Future<void> _onRefresh(Timer timer) async {
|
||||
return Future.delayed(const Duration(milliseconds: 1000), () {
|
||||
return Future.delayed(const Duration(milliseconds: 1000), () async {
|
||||
var orderInfo = await getHistoryDetail(widget.id);
|
||||
setState(() {
|
||||
detail = item;
|
||||
detail = orderInfo;
|
||||
_isRefreshing = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -100,7 +103,12 @@ class _OrderInfoPageState extends State<OrderInfoPage> {
|
||||
kIsWeb
|
||||
? Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: () => _onRefresh(_updateTimer),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isRefreshing = true;
|
||||
});
|
||||
_onRefresh(_updateTimer);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
shape: const RoundedRectangleBorder(
|
||||
@@ -122,13 +130,19 @@ class _OrderInfoPageState extends State<OrderInfoPage> {
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 5),
|
||||
_isRefreshing
|
||||
? const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
const SizedBox(height: 5),
|
||||
ListView.builder(
|
||||
itemCount: 3,
|
||||
itemCount: detail!.providers.length,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
final provider = detail!.providers[0];
|
||||
final provider = detail!.providers[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.symmetric(
|
||||
vertical: 10,
|
||||
|
||||
Reference in New Issue
Block a user