You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
708 B

import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
//TODO 路由重构计划
class CRoute {
static get isIOS => Platform.isIOS;
static Route _cPageRoute(BuildContext context, Widget child) {
return isIOS
? CupertinoPageRoute(builder: (context) => child)
: MaterialPageRoute(builder: (context) => child);
}
static Future push(BuildContext context, Widget page) async {
await Navigator.push(context, _cPageRoute(context, page));
}
///路由到根
static popBottom(BuildContext context) {
if (Navigator.canPop(context)) {
Navigator.pop(context);
popBottom(context);
} else {
return;
}
}
}