Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ux improving #2

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion front/lib/bus_arrival_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//버스 도착 정보 페이지
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
Expand Down Expand Up @@ -250,7 +251,7 @@ class _BusArrivalPageState extends State<BusArrivalPage> {
fontWeight: FontWeight.bold,
),
),
const TextSpan(text: ' 정류장\n'),
const TextSpan(text: '번째 정류장\n'),
const TextSpan(
text: '사색의광장',
),
Expand Down
1 change: 1 addition & 0 deletions front/lib/bus_company.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//버스 회사 데이터
const Map<String, dynamic> companyData = {"1":
{
"name":"용남고속",
Expand Down
1 change: 1 addition & 0 deletions front/lib/bus_history_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//과거 버스 도착 정보(버스별) 페이지
import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:http/http.dart' as http;
Expand Down
1 change: 1 addition & 0 deletions front/lib/bus_info.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//버스 노선 데이터
const Map<String,String> busRouteMap={
"9": "200000103",
"1112": "234000016",
Expand Down
3 changes: 1 addition & 2 deletions front/lib/bus_screen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//버스 노선 페이지
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'bus_timetable_page.dart';
import 'bus_arrival_page.dart';
class BusScreen extends StatelessWidget {
Expand Down
1 change: 1 addition & 0 deletions front/lib/bus_timetable_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//버스 시간표 페이지
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

Expand Down
109 changes: 109 additions & 0 deletions front/lib/company_info_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
//회사 정보 페이지
import 'package:flutter/material.dart';
import 'bus_company.dart';


class CompanyInfoPage extends StatelessWidget {
final String companyId;

const CompanyInfoPage({super.key, required this.companyId});

@override
Widget build(BuildContext context) {
final company = companyData[companyId];

return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () => Navigator.pop(context),
),
title: Text('${company['name']}'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'회사 정보',
style: TextStyle(
fontSize: 16,
color: Colors.grey,
),
),
const SizedBox(height: 16),
_buildInfoCard(company),
],
),
),
);
}

Widget _buildInfoCard(Map<String, dynamic> company) {
return Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.grey.shade300),
borderRadius: BorderRadius.circular(8),
),
child: Column(
children: [
_buildInfoItem(
icon: Icons.link,
title: '웹사이트 주소',
content: company['url'] ?? 'none',
),
_buildDivider(),
_buildInfoItem(
icon: Icons.phone,
title: '전화번호',
content: _formatPhones(company['phones']),
),
if (company['address'] != null) ...[
_buildDivider(),
_buildInfoItem(
icon: Icons.home,
title: '주소',
content: company['address'],
),
],
],
),
);
}

Widget _buildInfoItem({
required IconData icon,
required String title,
required String content,
}) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(icon, size: 24, color: Colors.black54),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(content),
],
),
),
],
),
);
}

Widget _buildDivider() {
return const Divider(height: 1, thickness: 1);
}

String _formatPhones(Map<String, dynamic> phones) {
return phones.entries
.map((e) => '${e.key}: ${e.value}')
.join('\n');
}
}
Loading
Loading