mirror of
https://github.com/wgh136/pixes.git
synced 2025-09-27 21:07:24 +00:00
user artworks; update ui
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class ColorScheme extends InheritedWidget{
|
||||
final Brightness brightness;
|
||||
|
||||
const ColorScheme({super.key, required this.brightness, required super.child});
|
||||
|
||||
static ColorScheme of(BuildContext context){
|
||||
return context.dependOnInheritedWidgetOfExactType<ColorScheme>()!;
|
||||
}
|
||||
|
||||
bool get _light => brightness == Brightness.light;
|
||||
|
||||
Color get primary => _light ? const Color(0xff00538a) : const Color(0xff9ccaff);
|
||||
|
||||
Color get primaryContainer => _light ? const Color(0xff5fbdff) : const Color(0xff0079c5);
|
||||
|
||||
Color get secondary => _light ? const Color(0xff426182) : const Color(0xffaac9ef);
|
||||
|
||||
Color get secondaryContainer => _light ? const Color(0xffc1dcff) : const Color(0xff1f3f5f);
|
||||
|
||||
Color get tertiary => _light ? const Color(0xff743192) : const Color(0xffebb2ff);
|
||||
|
||||
Color get tertiaryContainer => _light ? const Color(0xffcf9ae8) : const Color(0xff9c58ba);
|
||||
|
||||
Color get outline => _light ? const Color(0xff707883) : const Color(0xff89919d);
|
||||
|
||||
Color get outlineVariant => _light ? const Color(0xffbfc7d3) : const Color(0xff404752);
|
||||
|
||||
Color get errorColor => _light ? const Color(0xffff3131) : const Color(0xfff86a6a);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(covariant InheritedWidget oldWidget) {
|
||||
return oldWidget is!ColorScheme || brightness != oldWidget.brightness;
|
||||
}
|
||||
}
|
@@ -89,30 +89,43 @@ abstract class MultiPageLoadingState<T extends StatefulWidget, S extends Object>
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
loadData(_page).then((value) {
|
||||
if(value.success) {
|
||||
_page++;
|
||||
setState(() {
|
||||
_isFirstLoading = false;
|
||||
_data = value.data;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_isFirstLoading = false;
|
||||
_error = value.errorMessage!;
|
||||
});
|
||||
}
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Widget buildLoading(BuildContext context) {
|
||||
return const Center(
|
||||
child: ProgressRing(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildError(BuildContext context, String error) {
|
||||
return Center(
|
||||
child: Text(error),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if(_isFirstLoading){
|
||||
loadData(_page).then((value) {
|
||||
if(value.success) {
|
||||
_page++;
|
||||
setState(() {
|
||||
_isFirstLoading = false;
|
||||
_data = value.data;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_isFirstLoading = false;
|
||||
_error = value.errorMessage!;
|
||||
});
|
||||
}
|
||||
});
|
||||
return const Center(
|
||||
child: ProgressRing(),
|
||||
);
|
||||
return buildLoading(context);
|
||||
} else if (_error != null){
|
||||
return Center(
|
||||
child: Text(_error!),
|
||||
);
|
||||
return buildError(context, _error!);
|
||||
} else {
|
||||
return buildContent(context, _data!);
|
||||
}
|
||||
|
@@ -1,3 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' as md;
|
||||
|
||||
typedef MdIcons = Icons;
|
||||
typedef MdIcons = md.Icons;
|
||||
|
||||
class ColorScheme {
|
||||
static md.ColorScheme of(md.BuildContext context) {
|
||||
return md.Theme.of(context).colorScheme;
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:pixes/foundation/app.dart';
|
||||
|
||||
import 'color_scheme.dart';
|
||||
import 'md.dart';
|
||||
|
||||
class SegmentedButton<T> extends StatelessWidget {
|
||||
const SegmentedButton(
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:pixes/components/animated_image.dart';
|
||||
import 'package:pixes/components/color_scheme.dart';
|
||||
import 'package:pixes/foundation/app.dart';
|
||||
import 'package:pixes/foundation/image_provider.dart';
|
||||
import 'package:pixes/pages/user_info_page.dart';
|
||||
import 'package:pixes/utils/translation.dart';
|
||||
|
||||
import '../network/network.dart';
|
||||
import 'md.dart';
|
||||
|
||||
class UserPreviewWidget extends StatefulWidget {
|
||||
const UserPreviewWidget(this.user, {super.key});
|
||||
@@ -90,7 +90,7 @@ class _UserPreviewWidgetState extends State<UserPreviewWidget> {
|
||||
else
|
||||
Button(
|
||||
onPressed: follow,
|
||||
child: Text("Unfollow".tl, style: TextStyle(color: ColorScheme.of(context).errorColor),),
|
||||
child: Text("Unfollow".tl, style: TextStyle(color: ColorScheme.of(context).error),),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
Reference in New Issue
Block a user