2019-01-31 08:23:52 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
2019-09-02 15:52:32 +02:00
|
|
|
import 'package:git_touch/models/theme.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
2019-01-31 08:23:52 +01:00
|
|
|
|
|
|
|
class Loading extends StatelessWidget {
|
|
|
|
final bool more;
|
|
|
|
|
2019-02-10 06:17:25 +01:00
|
|
|
Loading({this.more = false});
|
2019-01-31 08:23:52 +01:00
|
|
|
|
|
|
|
Widget _buildIndicator(BuildContext context) {
|
2019-04-05 15:19:00 +02:00
|
|
|
// return Image.asset('images/loading.webp');
|
|
|
|
|
2019-09-02 15:52:32 +02:00
|
|
|
switch (Provider.of<ThemeModel>(context).theme) {
|
2019-09-19 15:10:50 +02:00
|
|
|
case AppThemeType.cupertino:
|
2019-01-31 08:23:52 +01:00
|
|
|
return CupertinoActivityIndicator(radius: 12);
|
|
|
|
default:
|
|
|
|
return Center(
|
|
|
|
child: SizedBox(
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
child: CircularProgressIndicator(),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
if (more) {
|
|
|
|
return Padding(
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 20),
|
|
|
|
child: _buildIndicator(context),
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Padding(
|
2019-02-10 12:15:50 +01:00
|
|
|
padding: EdgeInsets.symmetric(vertical: 50),
|
2019-01-31 08:23:52 +01:00
|
|
|
child: _buildIndicator(context),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|