generated from dellevin/template
基础epub阅读功能
This commit is contained in:
@@ -28,7 +28,7 @@ class TocDrawer extends StatelessWidget {
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.toc, size: 20, color: colors.onSurface.withValues(alpha: 0.6)),
|
||||
Icon(Icons.toc, size: 20, color: colors.onSurfaceVariant),
|
||||
const SizedBox(width: 10),
|
||||
Text('目录', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
const Spacer(),
|
||||
@@ -43,25 +43,27 @@ class TocDrawer extends StatelessWidget {
|
||||
Expanded(
|
||||
child: toc.isEmpty
|
||||
? Center(
|
||||
child: Text('暂无目录', style: TextStyle(color: colors.onSurface.withValues(alpha: 0.3))),
|
||||
child: Text('暂无目录', style: TextStyle(color: colors.onSurfaceVariant)),
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
itemCount: toc.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = toc[index];
|
||||
final indent = (item.level - 1) * 16.0;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
epubPlayerKey.currentState?.goToHref(item.href);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
padding: EdgeInsets.only(left: 20 + indent, right: 20, top: 12, bottom: 12),
|
||||
child: Text(
|
||||
item.title,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: colors.onSurface.withValues(alpha: 0.8),
|
||||
fontSize: item.level == 1 ? 14 : 13,
|
||||
fontWeight: item.level == 1 ? FontWeight.w500 : FontWeight.normal,
|
||||
color: colors.onSurface.withAlpha(204),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user