Skip to content

Commit

Permalink
fix(layout): fix screen layouts (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutsu3 authored Jan 20, 2025
1 parent 0dbdb24 commit b3f985b
Show file tree
Hide file tree
Showing 19 changed files with 787 additions and 705 deletions.
71 changes: 37 additions & 34 deletions lib/screens/app_logs/app_logs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,46 +53,49 @@ class AppLogs extends StatelessWidget {
const SizedBox(width: 10),
],
),
body: appConfigProvider.logs.isNotEmpty
? ListView.builder(
padding: const EdgeInsets.only(top: 0),
itemCount: appConfigProvider.logs.length,
itemBuilder: (context, index) => ListTile(
title: Text(
appConfigProvider.logs[index].message,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.normal,
color: Theme.of(context).colorScheme.onSurface,
body: SafeArea(
child: appConfigProvider.logs.isNotEmpty
? ListView.builder(
padding: const EdgeInsets.only(top: 0),
itemCount: appConfigProvider.logs.length,
itemBuilder: (context, index) => ListTile(
title: Text(
appConfigProvider.logs[index].message,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.normal,
color: Theme.of(context).colorScheme.onSurface,
),
),
subtitle: Text(
appConfigProvider.logs[index].dateTime.toString(),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: Theme.of(context).listTileTheme.textColor,
),
),
trailing: Text(appConfigProvider.logs[index].type),
onTap: () => {
showDialog(
context: context,
builder: (context) => AppLogDetailsModal(
log: appConfigProvider.logs[index],
),
),
},
),
subtitle: Text(
appConfigProvider.logs[index].dateTime.toString(),
)
: Center(
child: Text(
AppLocalizations.of(context)!.noSavedLogs,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: Theme.of(context).listTileTheme.textColor,
fontSize: 24,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
trailing: Text(appConfigProvider.logs[index].type),
onTap: () => {
showDialog(
context: context,
builder: (context) =>
AppLogDetailsModal(log: appConfigProvider.logs[index]),
),
},
),
)
: Center(
child: Text(
AppLocalizations.of(context)!.noSavedLogs,
style: TextStyle(
fontSize: 24,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
),
);
}
}
104 changes: 53 additions & 51 deletions lib/screens/domains/domain_details_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,60 +44,62 @@ class DomainDetailsScreen extends StatelessWidget {
const SizedBox(width: 10),
],
),
body: ListView(
children: [
CustomListTile(
leadingIcon: Icons.domain,
label: AppLocalizations.of(context)!.domain,
description: domain.domain,
),
CustomListTile(
leadingIcon: Icons.category_rounded,
label: AppLocalizations.of(context)!.type,
description: getDomainType(domain.type),
color: colors != null
? convertColorFromNumber(colors!, domain.type)
: null,
),
CustomListTile(
leadingIcon: Icons.schedule_rounded,
label: AppLocalizations.of(context)!.dateAdded,
description: formatTimestamp(domain.dateAdded, 'yyyy-MM-dd'),
),
CustomListTile(
leadingIcon: Icons.update_rounded,
label: AppLocalizations.of(context)!.dateModified,
description: formatTimestamp(domain.dateModified, 'yyyy-MM-dd'),
),
CustomListTile(
leadingIcon: Icons.check,
label: AppLocalizations.of(context)!.status,
description: domain.enabled == 1
? AppLocalizations.of(context)!.enabled
: AppLocalizations.of(context)!.disabled,
),
Material(
color: Colors.transparent,
child: InkWell(
onTap: domain.comment != null && domain.comment != ''
? () => {
showModal(
context: context,
builder: (context) =>
DomainCommentModal(comment: domain.comment!),
),
}
body: SafeArea(
child: ListView(
children: [
CustomListTile(
leadingIcon: Icons.domain,
label: AppLocalizations.of(context)!.domain,
description: domain.domain,
),
CustomListTile(
leadingIcon: Icons.category_rounded,
label: AppLocalizations.of(context)!.type,
description: getDomainType(domain.type),
color: colors != null
? convertColorFromNumber(colors!, domain.type)
: null,
child: CustomListTile(
leadingIcon: Icons.comment_rounded,
label: AppLocalizations.of(context)!.comment,
description: domain.comment == ''
? AppLocalizations.of(context)!.noComment
: domain.comment,
),
CustomListTile(
leadingIcon: Icons.schedule_rounded,
label: AppLocalizations.of(context)!.dateAdded,
description: formatTimestamp(domain.dateAdded, 'yyyy-MM-dd'),
),
CustomListTile(
leadingIcon: Icons.update_rounded,
label: AppLocalizations.of(context)!.dateModified,
description: formatTimestamp(domain.dateModified, 'yyyy-MM-dd'),
),
CustomListTile(
leadingIcon: Icons.check,
label: AppLocalizations.of(context)!.status,
description: domain.enabled == 1
? AppLocalizations.of(context)!.enabled
: AppLocalizations.of(context)!.disabled,
),
Material(
color: Colors.transparent,
child: InkWell(
onTap: domain.comment != null && domain.comment != ''
? () => {
showModal(
context: context,
builder: (context) =>
DomainCommentModal(comment: domain.comment!),
),
}
: null,
child: CustomListTile(
leadingIcon: Icons.comment_rounded,
label: AppLocalizations.of(context)!.comment,
description: domain.comment == ''
? AppLocalizations.of(context)!.noComment
: domain.comment,
),
),
),
),
],
],
),
),
);
}
Expand Down
21 changes: 14 additions & 7 deletions lib/screens/domains/domains.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,12 @@ class _DomainListsWidgetState extends State<DomainListsWidget>
if (MediaQuery.of(context).size.width > ResponsiveConstants.large) {
return Row(
children: [
Expanded(flex: 2, child: scaffold()),
Expanded(
flex: MediaQuery.of(context).size.width > ResponsiveConstants.xLarge
? 2
: 3,
child: scaffold(),
),
Expanded(
flex: 3,
child: selectedDomain != null
Expand All @@ -238,12 +243,14 @@ class _DomainListsWidgetState extends State<DomainListsWidget>
colors: serversProvider.colors,
)
: SizedBox(
child: Text(
AppLocalizations.of(context)!.selectDomainsLeftColumn,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24,
color: Theme.of(context).colorScheme.onSurfaceVariant,
child: SafeArea(
child: Text(
AppLocalizations.of(context)!.selectDomainsLeftColumn,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
),
Expand Down
30 changes: 18 additions & 12 deletions lib/screens/domains/domains_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,24 @@ class _DomainsListState extends State<DomainsList> {
onRefresh: () async => await domainsListProvider
.fetchDomainsList(serversProvider.selectedServer!),
),
AnimatedPositioned(
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
bottom: isVisible
? appConfigProvider.showingSnackbar
? 70
: 20
: -70,
right: 20,
child: FloatingActionButton(
onPressed: openModalAddDomainToList,
child: const Icon(Icons.add),
SafeArea(
child: Stack(
children: [
AnimatedPositioned(
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
bottom: isVisible
? appConfigProvider.showingSnackbar
? 70
: 20
: -70,
right: 20,
child: FloatingActionButton(
onPressed: openModalAddDomainToList,
child: const Icon(Icons.add),
),
),
],
),
),
],
Expand Down
110 changes: 60 additions & 50 deletions lib/screens/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,63 +219,73 @@ class _HomeState extends State<Home> {
? Stack(
children: [
Scaffold(
body: NestedScrollView(
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context,
body: SafeArea(
child: NestedScrollView(
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(
context,
),
sliver: HomeAppBar(
innerBoxIsScrolled: innerBoxIsScrolled,
),
),
sliver: HomeAppBar(
innerBoxIsScrolled: innerBoxIsScrolled,
),
),
];
},
body: SafeArea(
top: false,
bottom: false,
child: Builder(
builder: (context) => RefreshIndicator(
edgeOffset: 70,
onRefresh: () async {
await refreshServerStatus(context);
},
child: CustomScrollView(
slivers: [
SliverOverlapInjector(
handle: NestedScrollView
.sliverOverlapAbsorberHandleFor(context),
),
SliverList.list(
children: [
tiles(),
const SizedBox(height: 24),
const HomeCharts(),
const SizedBox(height: 16),
],
),
],
];
},
body: SafeArea(
top: false,
bottom: false,
child: Builder(
builder: (context) => RefreshIndicator(
edgeOffset: 70,
onRefresh: () async {
await refreshServerStatus(context);
},
child: CustomScrollView(
slivers: [
SliverOverlapInjector(
handle: NestedScrollView
.sliverOverlapAbsorberHandleFor(context),
),
SliverList.list(
children: [
tiles(),
const SizedBox(height: 24),
const HomeCharts(),
const SizedBox(height: 16),
],
),
],
),
),
),
),
),
),
),
AnimatedPositioned(
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
bottom: isVisible &&
statusProvider.getStatusLoading == LoadStatus.loaded
? appConfigProvider.showingSnackbar
? 70
: 20
: -70,
right: 20,
child: FloatingActionButton(
onPressed: enableDisableServer,
child: const Icon(Icons.shield_rounded),
SafeArea(
child: Stack(
children: [
AnimatedPositioned(
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
bottom: isVisible &&
statusProvider.getStatusLoading ==
LoadStatus.loaded
? appConfigProvider.showingSnackbar
? 70
: 20
: -70,
right: 20,
child: FloatingActionButton(
onPressed: enableDisableServer,
child: const Icon(Icons.shield_rounded),
),
),
],
),
),
],
Expand Down
Loading

0 comments on commit b3f985b

Please sign in to comment.