Question: In a logging structure, I have a list of states and within each state, there are several fields, each having a few attributes. Some of those fields have a attributes with the same name, but with different types, i.e. int versus float. Notice the 'timestamp' attribute in this particular example:

```
public class DroneState
{
    [XmlAttribute("timestamp")]
    public int timestamp;

    ...
}

public class SensorState
{
    [XmlAttribute("timestamp")]
    public float timestamp;

    ...
}

public class CombinedState
{
    [XmlElement("DroneState")]
    public DroneState droneState = null;
    [XmlElement("Sensor")]
    public SensorState sensorState = null;
}

public class FlightLog
{
    [XmlElement("States"), XmlArrayItem("State")]
    public List<CombinedState> states = new List<CombinedState>();

    public static void SaveToFile(FlightLog flightLog, string file)
    {
        XmlSerializer serializer = new XmlSerializer(typeof(FlightLog));
        string xml = string.Empty;
        // serialize and return string
        using (StringWriter writer = new StringWriter())
        {
            serializer.Serialize(writer, flightLog);
            xml = writer.ToString();
        }

        File.WriteAllText(file, xml);
    }
}

```

Using this code to generate an XML document, I get struck with the following exception:

> 
> InvalidOperationException: The XML attribute named 'timestamp' from namespace '' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the attribute.
> 
> 
> 

This is something I could have expected, but I don't seem to be capable of solving it. Whatever I try with regards to adding a namespace for each attribute, it keeps complaining that the attributes are allocated in the '' namespace.

What are the steps to take in making sure that each timestamp attribute is placed in its own namespace?

Answer: 
I did find some things that helped my situation... The widgets `DropdownButtonHideUnderline` and `Theme` will help control how the dropdown looks in the title of the `AppBar`

```
new AppBar(
  title: new Theme(
      child: new DropdownButtonHideUnderline(
      child: new DropdownButton<String>(
        value: _value,
        items: <DropdownMenuItem<String>>[
          new DropdownMenuItem(
            child: new Text('My Page'),
            value: 'one',
          ),
        ], 
        onChanged: (String value) {
          setState(() => _value = value);
        },
      ),
    ), 
    data: new ThemeData.dark(),
  ),
),

```

However, now the popup's background color is black to match the dark theme... not sure if there's a way to have the theme not affect the actual popup.

I personally can live with the black background color of the popup... unless someone can also solve that. 

[![enter image description here](https://i.stack.imgur.com/rpGhE.png)](https://i.stack.imgur.com/rpGhE.png)
[![enter image description here](https://i.stack.imgur.com/RlKRp.png)](https://i.stack.imgur.com/RlKRp.png)
Do something like this:

```
appBar: AppBar(
    title: Row(
      mainAxisSize: MainAxisSize.min,
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        DropdownButton(
          value: _selectedItem,
          items: _dropdownMenuItems,
          underline: SizedBox(height: 0,),
          //underline: SizedBox(),
          onChanged: onChangeDropdownItem,
        ),
       ],
      ),
    ),

```

Then change your dropdown menu's style here:

```
/// Initialize dropdown menu
List<DropdownMenuItem<String>> buildDropdownMenuItems(List menu) {
List<DropdownMenuItem<String>> items = List();
for (String li in menu) {
  items.add(
    DropdownMenuItem(
      value: li,
      child: SizedBox(
        width: 100, 
        child: Text(li, style:  TextStyle(color: labelColor, fontWeight: 
               FontWeight.bold), 
               textAlign: TextAlign.center, overflow: TextOverflow.ellipsis,),),
    ),
  );
}
return items;

```

}