Skip to content

Commit

Permalink
TolyPagination
Browse files Browse the repository at this point in the history
  • Loading branch information
toly1994328 committed Jun 19, 2024
1 parent 09d4fe4 commit bf57d56
Show file tree
Hide file tree
Showing 23 changed files with 783 additions and 612 deletions.
50 changes: 38 additions & 12 deletions assets/code_res/badge_demo1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,53 @@ class BadgeDemo1 extends StatelessWidget {

@override
Widget build(BuildContext context) {
return const Wrap(
Widget child = TolyAction(
selected: true,
child: const Icon(Icons.update, size: 24, color: Colors.green),
onTap: () {},
);

return Wrap(
spacing: 20,
children: [
Badge(
backgroundColor: Colors.redAccent,
smallSize: 10,
child: Icon(
Icons.update,
size: 36,
color: Colors.green,
smallSize: 6,
child: child,
),
Badge(
backgroundColor: Colors.orange,
alignment: Alignment.bottomRight,
smallSize: 6,
child: child,
),
Badge(
largeSize: 14,
backgroundColor: Colors.transparent,
padding: EdgeInsets.zero,
offset: Offset(5, -5),
label: ColoredBox(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(2.0),
child: Container(
decoration: BoxDecoration(
// border: Border.all( width: 2),
color: Colors.blue,
shape: BoxShape.circle),
width: 8,
height: 8,
),
),
),
// alignment: Alignment.center,
child: child,
),
Badge(
backgroundColor: Colors.redAccent,
smallSize: 10,
smallSize: 6,
isLabelVisible: false,
child: Icon(
Icons.update,
size: 36,
color: Colors.green,
),
child: child,
),
],
);
Expand Down
8 changes: 4 additions & 4 deletions assets/code_res/badge_demo2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class BadgeDemo2 extends StatelessWidget {
return const Badge(
backgroundColor: Colors.red,
label: Text('99'),
textStyle: TextStyle(fontSize: 8, color: Colors.red),
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 2),
largeSize: 14,
textStyle: TextStyle(fontSize: 8, color: Colors.red, height: 1),
padding: EdgeInsets.symmetric(horizontal: 6, vertical: 2),
largeSize: 12,
child: Icon(
Icons.message,
CupertinoIcons.mail,
size: 36,
color: Colors.indigo,
),
Expand Down
11 changes: 7 additions & 4 deletions assets/code_res/badge_demo3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class BadgeDemo3 extends StatelessWidget {
@override
Widget build(BuildContext context) {
final List<String> info = ['默认偏移和对齐', '偏移-4,-4', '偏移-2,-2;右下角'];
final List<Offset?> offsets = [null, const Offset(-4, -4), const Offset(-2, -2)];
final List<Offset?> offsets = [null, const Offset(-4, -2), const Offset(-2, -2)];
final List<Alignment?> alignments = [null, null, Alignment.bottomRight];

return Wrap(
Expand All @@ -25,13 +25,16 @@ class BadgeDemo3 extends StatelessWidget {
children: [
Badge(
backgroundColor: Colors.red,
label: const Text('99'),
label: const Text(
'99',
style: TextStyle(height: 1),
),
textStyle: const TextStyle(fontSize: 8, color: Colors.red),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
largeSize: 14,
offset: offset,
alignment: alignment,
child: const Icon(Icons.message, size: 36, color: Colors.indigo),
child: const Icon(CupertinoIcons.mail, size: 36, color: Colors.indigo),
),
Text(
info,
Expand Down
12 changes: 12 additions & 0 deletions assets/code_res/pagination_demo1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class PaginationDemo1 extends StatelessWidget {
const PaginationDemo1({super.key});

@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment.centerLeft,
child: TolyPagination(
total: 1000,
));
}
}
12 changes: 12 additions & 0 deletions assets/code_res/pagination_demo2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class PaginationDemo2 extends StatelessWidget {
const PaginationDemo2({super.key});

@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment.centerLeft,
child: TolyPagination(
total: 1000,
));
}
}
2 changes: 1 addition & 1 deletion lib/components/code_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_highlight/flutter_highlight.dart';
import 'package:toly_ui/app/theme/code_theme.dart';
import 'package:toly_ui/incubator/components/data/collapse/switch_panel.dart';
import 'package:toly_ui/incubator/components/data/collapse/collapse.dart';
import 'package:tolyui/tolyui.dart';

class CodeDisplay extends StatefulWidget {
Expand Down
Loading

0 comments on commit bf57d56

Please sign in to comment.